Compare commits

...

735 Commits
6.2 ... master

Author SHA1 Message Date
ALLEN-PC\acj30
7976a21b51 Fix crash when objects are pulled with the gravity gun 2025-01-18 10:36:13 -06:00
Blixibon
ab6dbb860d
Merge pull request #354 from mapbase-source/develop
Mapbase v7.3
2025-01-17 13:43:07 -06:00
ALLEN-PC\acj30
365d560f12 Updated README 2025-01-14 07:54:52 -06:00
Blixibon
6fbd411767
Merge pull request #357 from Blixibon/mapbase/feature/workflow-sln
Change workflow to use .sln and consolidate artifact tasks
2025-01-14 07:53:45 -06:00
ALLEN-PC\acj30
f79f07e915 Support for multiple colors for different outro credits columns on the same row 2025-01-14 07:52:50 -06:00
ALLEN-PC\acj30
cfe649e0e0 Change workflow to use .sln and consolidate artifact tasks 2025-01-13 22:47:15 -06:00
ALLEN-PC\acj30
93d586a82e Add vgui_controls to workflow for all projects 2025-01-12 15:56:02 -06:00
ALLEN-PC\acj30
5bc5a3beec Fix vgui_controls being considered a part of map tools in build workflow 2025-01-12 15:48:12 -06:00
ALLEN-PC\acj30
b03ffdcac4 Fix VScript not having "self" during precache, props not using death hook, VScript proxies not cleaning up correctly 2025-01-11 10:58:57 -06:00
Blixibon
66012e7c29
Merge pull request #260 from samisalreadytaken/netprops
CScriptNetPropManager rewrite
2025-01-11 10:58:24 -06:00
ALLEN-PC\acj30
d4b66b16cd Expose CBaseCombatCharacter glow funcs to VScript + add color functionality
Co-authored-by: Derek <1upderek@gmail.com>
2025-01-11 10:00:41 -06:00
ALLEN-PC\acj30
d51d44eb73 Fix forced interaction partners being made to face each other even when interaction doesn't require it 2025-01-11 09:59:27 -06:00
Blixibon
0ec851394f
Merge pull request #343 from Blixibon/mapbase/feature/door-vscript
Expose prop_door_rotating to VScript
2025-01-11 09:59:02 -06:00
ALLEN-PC\acj30
466183c4de New VScript functions for player use entity and pickup 2025-01-11 09:58:11 -06:00
ALLEN-PC\acj30
17af09b3d1 Fix workflow not terminating on compile error 2025-01-11 09:52:44 -06:00
ALLEN-PC\acj30
b055d77663 Move npc_metropolice enemy kill concept to Event_KilledOther() 2025-01-11 09:52:07 -06:00
ALLEN-PC\acj30
10f08829e5 Fix vgui_screen crashing for existing saves until v8.0 2025-01-10 08:30:49 -06:00
Blixibon
70a13c3306
Merge pull request #333 from Wikot235/NewNoclipCommand
Added a new ConVar that allows trigger_changelevel to be triggered by MOVETYPE_NOCLIP
2025-01-10 08:22:04 -06:00
ALLEN-PC\acj30
468fa81f47 Expose VPhysicsInitNormal and VPhysicsDestroyObject to VScript 2025-01-10 08:13:46 -06:00
Blixibon
7220a6de28
Merge pull request #292 from arbabf/develop
Add random spawn type for env_headcrabcanister
2025-01-10 08:12:06 -06:00
ALLEN-PC\acj30
ad423d1d07 OnStartTipped output for npc_turret_floor 2025-01-10 08:06:37 -06:00
ALLEN-PC\acj30
a5c754dd00 Fixes and expansions for Lost/FoundEnemySound on NPCs 2025-01-10 08:05:59 -06:00
Blixibon
8ef090c963
Merge pull request #312 from Wikot235/Zombie_improved
Minor npc_zombie improvements
2025-01-09 13:15:45 -06:00
ALLEN-PC\acj30
aa31835f36 Change new CNPC_BaseZombie customization vars to match actual data types 2025-01-09 12:50:19 -06:00
Wikot235
0921f7409b Fixed miscellaneous things. 2025-01-08 21:22:06 +01:00
ALLEN-PC\acj30
ed476cbbe7 Increment Mapbase version to v7.3 2025-01-08 09:28:38 -06:00
Blixibon
a72779a0e7
Merge pull request #342 from celisej567/particlemgr-UB-fix
[FIX] Undefined behaviour on comparison of NaN and float at particlemgr.cpp
2025-01-08 09:26:28 -06:00
ALLEN-PC\acj30
a00c8234e4 Expose prop_door_rotating to VScript 2025-01-08 09:20:51 -06:00
Wikot235
99c94f058b Added more customizability 2025-01-06 16:54:54 +01:00
Wikot235
959af0b130 m_iMeleeReach now defaults to 55 2025-01-05 16:13:16 +01:00
Blixibon
7b15e43302
Merge pull request #324 from SirYodaJedi/master
Don't network info_null/func_null
2025-01-05 08:14:27 -06:00
Blixibon
de598346da
Merge pull request #332 from samisalreadytaken/fix-oob
Fix OOB access
2025-01-04 08:50:13 -06:00
Blixibon
a8d69e56e3
Merge pull request #264 from Petercov/mapbase-feature/vgui-screens
Outputs for vgui_screen
2025-01-04 08:48:37 -06:00
Blixibon
e0967dea69
Merge pull request #294 from azzyr/patch-1
Fix vertex blend swapping in Hammer for SDK_LightmappedGeneric
2025-01-04 08:44:59 -06:00
Blixibon
e3ca25a9fc
Merge pull request #308 from Wikot235/Fix-BlurFilterY-uses-width-instead-of-height
Fixed BlurFilterY uses width instead of height
2025-01-04 08:44:19 -06:00
Blixibon
7da95edde1
Merge pull request #315 from Wikot235/Fix-Flare-Issue
Fixed issue #314 (Env_flare crash)
2025-01-04 08:43:54 -06:00
Blixibon
b51c5c3f86
Merge pull request #322 from z33ky/small-mapbase-fixes
Small mapbase fixes
2025-01-04 08:43:02 -06:00
celisej567
93bec9d7c0 Update particlemgr.cpp 2025-01-03 04:28:09 +03:00
celisej567
138f51e791 Update particlemgr.cpp 2025-01-03 04:01:44 +03:00
celisej567
e5d30605d5 float NaN undefined behavour fix 2025-01-03 02:26:39 +03:00
Blixibon
0464bd7fd3
Merge pull request #309 from Blixibon/mapbase/feature/spotlight-ignore-solid
Spotlight "Ignore solid" keyvalue from MP branch
2025-01-02 08:37:00 -06:00
Blixibon
98816adacc
Merge pull request #301 from Blixibon/mapbase/feature/sky-camera-multi-saverestore-fix
Fix maps with multiple sky_cameras not using the correct sky_camera after loading a save
2025-01-02 08:36:03 -06:00
Blixibon
038c66ef58
Merge pull request #300 from Blixibon/mapbase/feature/chromatic-aberration-effect
Primitive chromatic aberration effect for env_screeneffect
2025-01-02 08:35:25 -06:00
ALLEN-PC\acj30
4efb50283d Fix "Fade Corpse" spawnflag on NPCs not applying to serverside ragdolls 2025-01-02 08:34:03 -06:00
ALLEN-PC\acj30
bdc34e4bad Fix autocubemap crashing when not in a level 2025-01-02 08:33:22 -06:00
Blixibon
da44d97951
Merge pull request #297 from Blixibon/mapbase/feature/useable-ragdolls
Add capability to +USE serverside ragdolls and toggle cleanup of individual ragdolls
2025-01-02 08:31:09 -06:00
ALLEN-PC\acj30
b59214ca72 Fix dynamic interactions using "their_" keyvalues always assuming separate sequence names 2025-01-02 08:29:48 -06:00
ALLEN-PC\acj30
e954f00f79 Fix antlions using wrong angles for dynamic interactions 2025-01-02 08:28:38 -06:00
ALLEN-PC\acj30
f5db760a66 Add raw scene file support to GetSceneDuration() 2025-01-02 08:28:06 -06:00
ALLEN-PC\acj30
b19f329d5f Fix ai_dynint_always_enabled bypassing misc. criteria 2025-01-02 08:27:21 -06:00
Blixibon
72bd5fe948
Merge pull request #266 from rlenhub/develop
Implement "OnPhysGunPull" output in CPhysicsProp
2025-01-02 08:26:35 -06:00
Wikot235
47aa8ac3f4 Update triggers.cpp 2024-11-25 22:16:57 +01:00
samisalreadytaken
7ebb26c996 Fix OOB access on CBaseCombatCharacter::m_hMyWeapons 2024-11-22 16:38:36 +03:00
Alexander 'z33ky' Hirsch
696036219e Prevent signed overflow (UB) in SquirrelVM::GenerateUniqueKey() 2024-11-13 00:25:51 +01:00
Yui
337b58eb3c
Don't network info_null
Reduces potential for entity limit crashes, as it still exists for the first tick.
2024-09-09 10:33:07 -04:00
samisalreadytaken
ead5668dc8 Fix GetPropVector return type 2024-09-07 16:42:37 +03:00
Alexander 'z33ky' Hirsch
359fcb7196 Ditch attempts trying to obtain sound duration of MP3s
Crashes on Linux. Apparently returns incorrect values on Windows.
2024-09-05 23:45:20 +02:00
Alexander 'z33ky' Hirsch
a999c794f7 Fix minor case of const-correctness 2024-09-05 23:44:50 +02:00
Alexander 'z33ky' Hirsch
df6adcc5e9 Fix -Wdelete-incomplete in CDefaultCustomWeaponEntityFactory::ReleaseData()
GCC warns about attempting to delete a void-pointer, since it will not
be able to invoke its destructor. Fix by casing it to the expected
type.
2024-09-05 23:42:16 +02:00
Alexander 'z33ky' Hirsch
e9c45e5235 Implement GetColorForSurface() failure workaround
This function is used to color impact particles.
On Linux I've noticed that this function sometimes is not successful on
retrieving the surface color, leaving an odd color to render the
particles with. The engine function TraceLineMaterialAndLighting() even
has a boolean return value indicating success.
GetModelMaterialColorAndLighting() does not though, but I still observe
failures (the color parameter is not modified). The color is initialized
with an invalid value. If it detects that retrieving the color failed
(engine function said so or the invalid value was left in place), this
now hamfistedly assumes a lightish grey color, but at least still
correctly (presumably) incorporates lighting information.
When this situation is detected, a warning is also printed to the
console. Because why not.
2024-09-05 23:35:46 +02:00
ALLEN-PC\acj30
5d50335c02 New "Destroy" input for func_combine_ball_spawner 2024-08-10 13:51:06 -05:00
ALLEN-PC\acj30
102c7c3015 New "StopActionLoop" input for scripted_sequence 2024-08-10 13:49:19 -05:00
ALLEN-PC\acj30
06596695a3 Fix filter_activator_model issues with save/restore and null activator 2024-08-10 13:48:48 -05:00
ALLEN-PC\acj30
178a262032 Add VScript function for checking last hit group on CBaseCombatCharacter 2024-08-10 13:47:53 -05:00
Wikot235
4f14f0c5cc Fixed the issue. 2024-08-07 13:16:37 +02:00
Wikot235
a736b0f96a Added new spawnflag 2024-07-28 14:11:06 +02:00
Wikot235
41233cb475 Added Melee attack keyvalue 2024-07-27 23:49:31 +02:00
ALLEN-PC\acj30
5cf63d4eb6 Spotlight "Ignore solid" keyvalue from MP branch 2024-06-28 16:09:37 -05:00
Wikot235
cd6ec90a0f Fixed the issue. 2024-06-24 23:42:07 +02:00
ALLEN-PC\acj30
73988dcc7c Fix maps with multiple sky_cameras not using the correct sky_camera after loading a save 2024-06-22 02:33:19 -05:00
ALLEN-PC\acj30
33e047a442 Primitive chromatic aberration effect for env_screeneffect 2024-06-22 01:44:20 -05:00
ALLEN-PC\acj30
24f3656632 Add capability to +USE serverside ragdolls and toggle cleanup of individual ragdolls 2024-06-21 18:22:04 -05:00
azzy
a49cff34f9
Fix vertex blend swapping in Hammer for SDK_LightmappedGeneric
Out of bounds array index corrupting the stack
2024-04-27 04:31:21 +03:00
arbabf
2c001ff259 Change RANDOM_CRAB_TYPE to -1 2024-04-13 16:10:01 +10:00
arbabf
f370074d10 Fix spacing to be more consistent 2024-04-13 00:46:36 +10:00
arbabf
2113410f80 Add random spawn type for env_headcrabcanister 2024-04-13 00:43:14 +10:00
ALLEN-PC\acj30
471a840ed9 Fix soundlevel_t compile error on VS2013 2024-03-09 02:13:59 -06:00
Blixibon
7f0aec4371
Merge pull request #250 from mapbase-source/develop
Mapbase v7.2
2024-02-25 15:48:08 -06:00
ALLEN-PC\acj30
6bd9bcba5d Increment version numbers to v7.2 2024-02-24 21:19:52 -06:00
rlen
f86a967af2
Merge branch 'mapbase-source:develop' into develop 2024-02-19 21:46:36 +09:00
rlen
f484aa7ebc removed pullDir parameter from OnPhysGunPull 2024-02-19 21:46:04 +09:00
ALLEN-PC\acj30
8f7b70768e Updated README 2024-02-04 22:30:59 -06:00
Blixibon
f8d8cf6d2f
Merge pull request #279 from samisalreadytaken/fix-weapon_custom_scripted
weapon_custom_scripted fixes
2024-02-04 15:27:32 -06:00
Blixibon
02f81094e5
Merge pull request #275 from Blixibon/mapbase/feature/response-followup-criteria-expansion
Better circumstantial criteria for followup responses
2024-02-04 15:26:39 -06:00
Blixibon
11533fa292
Merge pull request #274 from Blixibon/mapbase/feature/dot-slash-command-line-param
Command line parameter to support dot slashes in VScript file read calls
2024-02-04 15:26:02 -06:00
Blixibon
782053e0b2
Merge pull request #273 from Blixibon/mapbase/feature/zombie-no-flinch-during-unique-anim
Cvar to disable zombie flinching during actbusies or scripted sequences
2024-02-04 15:25:09 -06:00
Blixibon
4e3f58f4b5
Merge pull request #272 from Blixibon/mapbase/feature/zombie-serverside-headcrab-ragdoll-fixes
Fix serverside zombie headcrab ragdoll not using correct origin
2024-02-04 15:24:31 -06:00
Blixibon
4c2823e814
Merge pull request #271 from Blixibon/mapbase/feature/new-companion-npc-concepts
New and ported response concepts for companion NPCs
2024-02-04 15:24:09 -06:00
Blixibon
4cea5d1123
Merge pull request #270 from Blixibon/mapbase/feature/dynamic-interaction-improvements
NPC dynamic interaction improvements and fixes
2024-02-04 15:23:40 -06:00
Blixibon
47ddedb153
Merge pull request #269 from Blixibon/mapbase/feature/anim-event-improvements
New animation events + OnScriptEvent outputs for ai_hint
2024-02-04 15:22:31 -06:00
Blixibon
8505ab4579
Merge pull request #262 from Blixibon/mapbase/feature/hl2-pistol-upwards-viewkick
weapon_pistol upwards view kick cvar
2024-02-04 15:22:03 -06:00
Blixibon
de01ce6292
Merge pull request #261 from samisalreadytaken/dev
Misc vscript additions
2024-02-04 15:20:12 -06:00
samisalreadytaken
f1123ed1e7 Tidy up CSimpleCallChainer::PostScriptExecute() 2024-02-02 17:06:25 +03:00
samisalreadytaken
a6f9d0a0e2 Fix CBaseEntity::ScriptGetKeyValue() returning cached string on invalid input 2024-02-02 17:06:25 +03:00
samisalreadytaken
976eb23299 Add vscript funcs
Panel::RemoveTickSignal()
CAI_BaseNPC::IsMedic()
2024-02-02 17:06:25 +03:00
samisalreadytaken
a02f3db05b Fix weapon_custom_scripted hook calls 2024-01-26 23:42:52 +03:00
samisalreadytaken
19702d067d Fix weapon_custom_scripted ItemPreFrame base call 2024-01-26 23:42:52 +03:00
ALLEN-PC\acj30
5afe4fa08b Merge branch 'master' into develop 2024-01-11 17:39:03 -06:00
ALLEN-PC\acj30
82bc30cc26 Fix GitHub workflow not installing packages properly 2024-01-11 17:38:01 -06:00
ALLEN-PC\acj30
4adab15982 Add better circumstantial criteria to followup responses 2024-01-06 16:20:09 -06:00
ALLEN-PC\acj30
a96147a6d8 Add command line parameter to allow VScript file read paths with dot slashes 2024-01-05 15:01:44 -06:00
ALLEN-PC\acj30
4e7814eeea Fix function call being in the wrong place 2024-01-05 14:57:43 -06:00
ALLEN-PC\acj30
a3fe8b5284 Add cvar to prevent zombies from flinching during actbusies and scripted sequences 2024-01-05 14:55:01 -06:00
ALLEN-PC\acj30
8b7c6952ba Fix AE_ZOMBIE_POPHEADCRAB using inaccurate headcrab release position 2024-01-05 14:40:37 -06:00
ALLEN-PC\acj30
06b27acd74 Fix CNPC_BaseZombie::HeadcrabFits() and blood impacts not working with serverside ragdolls 2024-01-05 14:39:26 -06:00
ALLEN-PC\acj30
14675578a8 Fix "their_" misc criteria not being registered 2024-01-05 14:33:33 -06:00
ALLEN-PC\acj30
7c5c90ebeb Fix TLK_NEW_ENEMY not playing on headcrabs or zombies 2024-01-05 13:26:47 -06:00
ALLEN-PC\acj30
e1c890a011 New response context-based check for TLK_SPOTTED_HEADCRAB_LEAVING_ZOMBIE (because some death types, such as serverside ragdolling, remove the zombie instantly) 2024-01-05 13:19:33 -06:00
ALLEN-PC\acj30
3ce8a35567 Add func_tank behavior criteria 2024-01-03 16:01:07 -06:00
ALLEN-PC\acj30
a2a4aa3082 Add additional enemy criteria to NPC speech 2024-01-03 16:00:47 -06:00
ALLEN-PC\acj30
9070d9a844 Optional support for fired bullets notifying targets (currently only used for NPC companion speech) 2024-01-03 16:00:10 -06:00
ALLEN-PC\acj30
85c1f7d113 Add new response concepts + port several Alyx concepts for companion NPCs 2024-01-03 15:57:18 -06:00
ALLEN-PC\acj30
3861c6a742 Fix semicolon 2024-01-03 14:21:28 -06:00
ALLEN-PC\acj30
959332b343 Fix related interactions having greater delays stomped out 2024-01-03 13:43:48 -06:00
ALLEN-PC\acj30
591039439c Fixes and hacks for HL2 NPCs performing dynamic interactions 2024-01-03 13:32:49 -06:00
ALLEN-PC\acj30
dc8fe6021d Fix dynamic interaction problems caused by walkframe sequence movement 2024-01-03 13:31:38 -06:00
ALLEN-PC\acj30
869ec6d0dd Improved debugging for dynamic interaction distance 2024-01-03 13:30:10 -06:00
ALLEN-PC\acj30
a88091a4d9 Enhancements for interactions which don't test angles (including a new pose parameter to change animations based on angle) 2024-01-03 13:27:46 -06:00
ALLEN-PC\acj30
fd149ff161 Add new dynamic interaction keyvalues and utilities 2024-01-03 13:19:38 -06:00
ALLEN-PC\acj30
0d37ded0eb Add OnScriptEvent outputs to ai_hint 2024-01-03 12:49:10 -06:00
ALLEN-PC\acj30
e44f60e8d8 Add new VScript and particle anim events 2024-01-03 12:47:29 -06:00
rlen
02e232babf add "OnPhysGunPull" output to CPhysicsProp 2024-01-02 01:45:22 +09:00
Peter Covington
9e2bdaab58
Fixed vgui_screens always sending a mouse released event to the panel when the vgui_screen loses focus 2023-12-29 21:26:58 -05:00
Peter Covington
9f34a64e63
Vgui screens now try to pass panel commands to the entity that created them 2023-12-29 14:10:22 -05:00
Peter Covington
eb46739ab5
Fixed vgui screens potentially crashing on save 2023-12-23 11:53:32 -05:00
Peter Covington
146df3c961
Also suppress attack3 in vgui screen mode 2023-12-23 11:53:27 -05:00
Peter Covington
e304b1a90e
Fixed C_VGuiScreen sending reversed pressed/unpressed events to the panel 2023-12-23 11:53:22 -05:00
Peter Covington
db0e0fc29e
SiN: Episodes compatible VGUI Screens 2023-12-23 11:53:09 -05:00
ALLEN-PC\acj30
b97a58e9fa Add optional upwards viewkick to HL2 weapon_pistol 2023-12-17 11:55:51 -06:00
samisalreadytaken
c86bf826e0 Rewrite CScriptNetPropManager 2023-12-17 18:47:09 +03:00
ALLEN-PC\acj30
e34e0d3b10 Updated README 2023-11-24 11:08:41 -06:00
ALLEN-PC\acj30
5de0ee49bd Fix a few syntax mistakes involving bool functions returning NULL 2023-11-24 10:56:56 -06:00
ALLEN-PC\acj30
a131bf42a6 Fix unarmed citizens not picking up weapons from racks 2023-11-24 10:46:45 -06:00
ALLEN-PC\acj30
6a0a0154c6 SetClassRelationship function for VScript 2023-11-24 10:45:56 -06:00
ALLEN-PC\acj30
5fe4621eb6 Various comment changes 2023-11-24 10:45:25 -06:00
ALLEN-PC\acj30
424fcf0792 Add extra trace to npc_create for NPCs which should use bbox instead of hull (e.g. npc_rollermine) 2023-11-24 10:29:02 -06:00
ALLEN-PC\acj30
e7cdb69c58 Fix ai_relationship_classify not working properly after loading save 2023-11-24 10:27:48 -06:00
ALLEN-PC\acj30
650ddeeceb Minor Mapbase workflow fixes 2023-11-10 17:08:22 -06:00
ALLEN-PC\acj30
ecb58e4246 Fix game_text and logic_format not functioning properly on Linux 2023-11-10 15:13:36 -06:00
ALLEN-PC\acj30
d981f6a005 Fix Linux compile for AI grenade hints 2023-11-03 19:09:19 -05:00
ALLEN-PC\acj30
c6ee15336f Fix CBaseEntity::CanBeHitByMeleeAttack() not blocking damage from CTraceFilterMelee 2023-11-03 16:34:00 -05:00
ALLEN-PC\acj30
0e110b7823 Fix ai_relationship_classify applying before default relationships loaded 2023-11-03 16:31:09 -05:00
ALLEN-PC\acj30
aa03b6b51e Fix custom procedural crash 2023-11-03 16:29:27 -05:00
ALLEN-PC\acj30
032cfdaec3 New Get/SetGroundEntity, Get/SetModelScale functions for VScript 2023-11-03 16:29:02 -05:00
ALLEN-PC\acj30
d18b5a2144 Fix clientside C_BaseCombatCharacter hierarchy in VScript 2023-11-03 16:27:42 -05:00
ALLEN-PC\acj30
cae8a7d28a AI grenade throw hints 2023-11-03 16:25:29 -05:00
ALLEN-PC\acj30
8194d80831 Fix typo in logic_branch removal signal for logic_branch_listener 2023-10-25 10:49:23 -05:00
ALLEN-PC\acj30
bdef83449e Fix mapspawn_addon not loading from VPK paths 2023-10-25 10:46:34 -05:00
Blixibon
c3f0509e72
Merge pull request #236 from Crimson-X1/feature/prop_sprinting
Toggleable "Prop Sprinting" Mechanic
2023-10-25 00:56:22 -05:00
Blixibon
715acf4ff5
Apply suggestions from code review 2023-10-25 00:26:29 -05:00
Blixibon
db1b6872ca
Merge pull request #248 from Mechami/misc_conversion_fixes
Fixed warnings about conversions between soundlevel_t and float
2023-10-24 23:41:11 -05:00
ALLEN-PC\acj30
c406a6702f Fix ViewPunch random for singleplayer AR2 2023-10-24 23:25:01 -05:00
Blixibon
8e9020c741
Merge pull request #245 from Mr0maks/fix_random_in_ar2
Fix ViewPunch random for AR2
2023-10-24 23:23:16 -05:00
Blixibon
8280197df3
Merge pull request #237 from AgentAgrimar/master
Assign Held Physcannon Entity to Pass into Commander Goal Trace
2023-10-24 22:59:39 -05:00
Blixibon
9e6035bb1f
Merge pull request #231 from Petercov/mapbase-feature/hl1-mouth-fix
Fixed sentence source bug
2023-10-24 22:51:04 -05:00
Blixibon
323f9fc46a
Merge pull request #230 from Petercov/mapbase-feature/caption-fixes
Caption Fixes
2023-10-24 22:50:21 -05:00
Blixibon
68ea86ec4f
Merge pull request #229 from arbabf/develop
Extend point_bugbait functionality
2023-10-24 22:26:50 -05:00
ALLEN-PC\acj30
75e39c33fd Fix Linux compile for custom weapons 2023-10-24 22:07:35 -05:00
ALLEN-PC\acj30
8729bebe5f Swap clientside weapon precache back to fix ammo not showing up correctly on HUD 2023-10-24 22:07:27 -05:00
Blixibon
8c338156e0
Fix existing point_bugbaits not using radius 2023-10-24 21:33:01 -05:00
Blixibon
9591e92fa1
Merge pull request #217 from samisalreadytaken/vscript_vgui-patch
vscript vgui hud viewport parent
2023-10-24 20:13:01 -05:00
Blixibon
6915787c80
Merge pull request #183 from Petercov/mapbase-feature/custom-weapons
Enhanced custom weapons support
2023-10-24 19:12:05 -05:00
Philip Muzzall
2fe3adfe6e
Fixed warnings about conversions between soundlevel_t and float
This replaces the macros ATTN_TO_SNDLVL and SNDLVL_TO_ATTN with inline functions that properly handle conversions between float and soundlevel_t. Eliminates a large number of warnings when compiling with GCC.
2023-09-24 16:30:22 -07:00
Mr0maks
cbb119b0ad Fix ViewPunch random for AR2 2023-08-25 22:50:18 +05:00
Agent Agrimar
1876d1abf4 Properly assign held physcannon entity to pass into commander goal trace 2023-05-15 00:39:26 -04:00
Crimson-X1
f8d3bea87e Initial commit 2023-04-03 14:24:20 -07:00
ALLEN-PC\acj30
f4c2cb4795 Fix vgui_controls not working outside of client.dll 2023-03-30 19:10:44 -05:00
Peter Covington
ebe9a8eb3d Fixed HL1 style lipsync 2023-02-24 18:34:53 -05:00
Arbab Ahmed
1ff5d61d4f Add new inputs for the new functionality 2023-02-20 23:21:09 +11:00
Peter Covington
b5deefa088 Fixed delayed closed captions 2023-02-19 19:28:33 -05:00
Peter Covington
e672c3521c Fixed missing some closecaptions 2023-02-19 19:28:29 -05:00
Peter Covington
54cd6f7eb3 Fixed captions not loading from vpks 2023-02-19 19:28:11 -05:00
Arbab Ahmed
172417867b add mins and maxs to point_bugbait 2023-02-19 20:01:32 +11:00
samisalreadytaken
63a9dce4d4 Disable vscript entity listeners on level shutdown 2023-01-24 21:42:45 +03:00
samisalreadytaken
3f2f562a1e Fix image rotation in vgui::ImagePanel 2023-01-22 17:30:46 +03:00
samisalreadytaken
2d183a8e2a Add recursive KV read/write on CScriptKeyValues 2023-01-05 20:00:15 +03:00
Crimson-X1
783c8e8fb7
Merge branch 'mapbase-source:develop' into develop 2022-12-27 19:06:16 -08:00
samisalreadytaken
f5837d068f Change vscript net message header size to 4 bytes from 2 bytes
to reduce hash collisions
2022-12-27 16:00:08 +03:00
samisalreadytaken
53d6ae6848 Explicitly state header bit count in CNetMsgScriptHelper 2022-12-27 15:59:19 +03:00
samisalreadytaken
4a77eb2a0d Add vscript created font support on vgui_text_display 2022-12-04 13:40:41 +03:00
ALLEN-PC\acj30
af6f9fe518 Added a more concrete Linux exception for Discord RPC 2022-12-02 19:03:29 -06:00
samisalreadytaken
9e47b5a217 Add vscript created custom font support on game_text (CHudMessage) 2022-12-02 22:36:12 +03:00
samisalreadytaken
7011b893af Fix CHudMessage::MessageDrawScan ignoring custom font size 2022-12-02 22:31:24 +03:00
samisalreadytaken
f8591316fa Clarify comment 2022-12-01 13:00:32 +03:00
ALLEN-PC\acj30
2fb704a129 Updated README 2022-11-30 08:35:31 -06:00
samisalreadytaken
1aff4bb9b9 Assert on concommand hook crash 2022-11-26 20:12:35 +03:00
Blixibon
9df9233e54
Fix mapbase_pr.yml causing problems in forks 2022-11-25 15:29:45 -06:00
Blixibon
81527d3be8
Fix mapbase_build-base-dispatch.yml 2022-11-24 12:33:27 -06:00
Blixibon
d771694d4b
Merge pull request #207 from mapbase-source/develop
Mapbase v7.1
2022-11-24 10:21:09 -06:00
samisalreadytaken
5e891f85a6 Update vscript_vgui
enabled parenting to clientmode hud viewport
added script func `vgui.GetHudViewport()`
fixed case sensitivity of panel classname and panel callback inputs
fixed script fonts not being reloaded when no panel parented to the root was created
2022-11-24 13:39:59 +03:00
Blixibon
bbd8d86f87 Fix metrocops using the wrong animation when pushing player with a gun 2022-11-22 17:14:57 -06:00
Blixibon
390dd80e41 Updated README 2022-11-21 23:24:18 -06:00
Blixibon
b2110d0354 Added NPC PVS checking for point_cameras 2022-11-21 00:51:54 -06:00
Blixibon
a2e91759e0 Added "DUAL_PISTOLS" as new category of optional unused HL2 weapon activities 2022-11-21 00:48:21 -06:00
Blixibon
d6f4ea38a2 Fixed typo in weapon_sniperrifle.cpp 2022-11-21 00:47:05 -06:00
Blixibon
76d981838d Fixed PickupWeaponInstant input crash on Linux 2022-11-21 00:46:32 -06:00
Blixibon
4cc1816b5c
Merge pull request #213 from samisalreadytaken/vscript_vgui-patch
vscript vgui HUD visibility control
2022-11-21 00:45:02 -06:00
samisalreadytaken
1ca7558421 Fix func_fake_worldportal clip plane 2022-11-17 10:45:03 +03:00
samisalreadytaken
cc0c90693d Optimise func_fake_worldportal render code
Consistent and descriptive variable names, simplified calculations.
2022-11-17 10:44:19 +03:00
samisalreadytaken
713c8e8cf3 Optimise 3D skybox rotation 2022-11-17 10:27:48 +03:00
samisalreadytaken
c3e2ab3385 Add missing vscript const FCVAR_CHEAT 2022-11-17 10:27:48 +03:00
samisalreadytaken
ac45061b36 Add debug cvar script_net_debug 2022-11-17 10:27:48 +03:00
samisalreadytaken
e843aed912 Debug assertion on SquirrelVM::GetValue() 2022-11-17 10:27:46 +03:00
samisalreadytaken
da2315cfe7 Update vscript_vgui 2022-11-04 12:44:22 +03:00
samisalreadytaken
760e1e6dd5 Add vscript SetHudElementVisible 2022-11-01 16:45:46 +03:00
samisalreadytaken
2b612a28f4 Revert "Added more convenient way to hide HUD elements from clientside VScript"
This reverts commit 6ceb808f93694328d053c8dc03e82bb1fe7c408a.
2022-11-01 15:50:04 +03:00
Blixibon
f5cf90dbc3 Updated GitHub workflows 2022-10-30 13:33:43 -05:00
Blixibon
8da7734c0d Fixed mapspawn_addon on Linux and made related console messages more verbose 2022-10-30 13:32:55 -05:00
Blixibon
db6305fcee Removed prototype "addon manifest" implementation added in v7.0 (superceded by mapspawn_addon and near-unusable for Steam Workshop) 2022-10-30 13:31:52 -05:00
Blixibon
6ceb808f93 Added more convenient way to hide HUD elements from clientside VScript 2022-10-30 13:30:02 -05:00
Blixibon
2214301694 Updated mapbase_build-base.yml 2022-10-27 01:26:32 -05:00
Blixibon
0b70acff08 Added mapbase_build-master.yml workflow 2022-10-26 23:14:16 -05:00
Blixibon
0aca548e15 Updated CONTRIBUTING.md 2022-10-26 23:05:59 -05:00
Blixibon
74faeaeb04 Added GetCurrentBetaName and IsAppInstalled to VScript Steam API 2022-10-26 23:05:28 -05:00
Blixibon
9b3977e30d Fix crash with player use animations 2022-10-26 23:02:46 -05:00
Blixibon
a7c90b042d Fix hand viewmodel issues on death/respawn 2022-10-26 23:01:50 -05:00
Blixibon
5cc53c10ee Fix Combine dropships not dropping APCs correctly after save/load 2022-10-26 22:09:32 -05:00
Blixibon
15f321d4e9 Updated README 2022-10-26 13:44:39 -05:00
Blixibon
8d25fb72b1 Updated README 2022-10-26 13:39:43 -05:00
Blixibon
fd4133485a Fix uninitialized variable in math_clamp 2022-10-26 13:38:28 -05:00
Blixibon
12742b7815 Fix spacing in particle system files 2022-10-26 13:37:59 -05:00
Blixibon
63a888252f
Merge pull request #169 from samisalreadytaken/vscript_vgui
vscript vgui
2022-10-26 08:18:23 -05:00
Blixibon
8039c9befa
Update mapbase_pr.yml 2022-10-24 13:35:31 -05:00
Blixibon
9db4259f18
Update .github/workflows/mapbase_build-base-dispatch.yml
Co-authored-by: samisalreadytaken <46823719+samisalreadytaken@users.noreply.github.com>
2022-10-24 13:32:08 -05:00
Blixibon
21407c3394
Update sp/src/game/server/particle_system.cpp
Co-authored-by: samisalreadytaken <46823719+samisalreadytaken@users.noreply.github.com>
2022-10-22 16:06:57 -05:00
samisalreadytaken
b5ba3f69c7 Add vscript vgui 2022-10-22 22:22:22 +03:00
Blixibon
00f00b508f Updated README 2022-10-22 02:13:18 -05:00
Blixibon
64babc6387 Merge branch 'develop' of https://github.com/mapbase-source/source-sdk-2013 into develop 2022-10-22 02:12:59 -05:00
Blixibon
3546bf9077 Added new labels to GitHub labeler 2022-10-22 02:12:34 -05:00
Blixibon
216ea46c25
Merge pull request #206 from samisalreadytaken/fix
Fix CScriptNetMsgHelper::WriteEntity()
2022-10-21 22:54:12 -05:00
Blixibon
924f2112b1
Merge pull request #193 from arbabf/develop
New entity: info_particle_system_coordinate, plus infinite cooldown functionality for prop_interactable
2022-10-21 22:52:06 -05:00
arbabf
0c9883f5e2
Merge branch 'mapbase-source:develop' into develop 2022-10-22 12:30:51 +11:00
Blixibon
3f5807f1fd
GitHub build workflows (#204) 2022-10-21 12:49:33 -05:00
Blixibon
03fffae585 Updated README 2022-10-21 10:21:09 -05:00
Blixibon
e2569f6657 Fixed Linux debug build 2022-10-21 10:20:01 -05:00
Blixibon
d93a2f0b17 Added shadow filter keyvalue to env_projectedtexture 2022-10-21 10:14:51 -05:00
Blixibon
b5428d5a77 Fixed Response System not including scripts on Linux 2022-10-20 23:33:43 -05:00
samisalreadytaken
a2cf90e3ac Remove redundant SquirrelSafeCheck instance 2022-10-17 23:10:10 +03:00
Blixibon
2272b75772 Disabled Discord/Mapbase RPC by default 2022-10-17 13:37:58 -05:00
Blixibon
c2d2df8c42 Fixed forgotten #include in KeyValues.cpp 2022-10-17 12:51:23 -05:00
Blixibon
a1ab1616c5 Added VScript functions for checking the platform the server/client is using 2022-10-17 10:34:29 -05:00
Blixibon
eb4d01a988 Fixed commentary speakers and printname not being combined properly on Linux 2022-10-17 10:15:05 -05:00
Blixibon
5e473aa618 Merge branch 'develop' of https://github.com/mapbase-source/source-sdk-2013 into develop 2022-10-16 15:19:25 -05:00
Blixibon
1bf1225544 Incremented version numbers to v7.1 2022-10-16 15:18:51 -05:00
Blixibon
852d63ba6f Added support for "custom" conditionals in KeyValues 2022-10-16 15:16:53 -05:00
Blixibon
ccdc1719ae Fixed negated conditionals not being recognized by hudanimations.txt 2022-10-16 15:16:02 -05:00
Blixibon
7b836ece91 Added support for hud_showemptyweaponslots 0 in hud_fastswitch 2 2022-10-16 15:14:25 -05:00
Blixibon
802463acfb Removed /force:multiple from client VPC for newer VS toolsets 2022-10-16 15:13:36 -05:00
Blixibon
d231606020 Fixed crash when a prop_dynamic with a model scale has no physics object 2022-10-16 15:12:59 -05:00
Blixibon
e9ade193dc
Merge pull request #174 from undnull/v142-patch-1
Fix a symbol being defined twice
2022-10-16 13:55:12 -05:00
Blixibon
6945ef2468 Fixed npc_sniper not acquiring player as target after SP respawn 2022-10-16 13:47:29 -05:00
Blixibon
8cf06b2865 Fixed GCC error in ivscript.h 2022-10-16 10:06:26 -05:00
Blixibon
2ca2d7c80f Specified 32-bit for gcc9+support.o 2022-10-16 10:05:40 -05:00
samisalreadytaken
7849b1440f Clarify comment 2022-10-14 18:25:46 +03:00
samisalreadytaken
9bf1fb4cea Fix CScriptNetMsgHelper::WriteEntity() 2022-10-14 18:23:33 +03:00
Crimson-X1
8e28451528
Merge branch 'mapbase-source:develop' into develop 2022-10-07 23:16:22 -07:00
Blixibon
4aeaaa46c7
Merge pull request #113 from mapbase-source/develop
Mapbase v7.0
2022-10-05 20:37:37 -05:00
Blixibon
f5633dcc75 Updated README 2022-10-02 19:23:22 -05:00
Blixibon
c31e48591f Fixed crash from TestEntity on filters 2022-10-02 19:12:42 -05:00
Blixibon
be6277c2c8 Fixed commentary node HUD alignment issues 2022-10-02 19:11:24 -05:00
Crimson-X1
9eae9213c8
Merge pull request #14 from mapbase-source/develop 2022-09-09 23:11:44 -07:00
Blixibon
daf55037fe Added support for "mapspawn_addon" scripts in addon paths (inspired by L4D2) 2022-08-28 13:10:23 -05:00
Blixibon
1426eccc68 Strengthened NaN head angle brute force workaround 2022-08-28 13:08:28 -05:00
Blixibon
3c7d0f86b3 Fixed global state counters not being initialized 2022-08-28 13:06:55 -05:00
Blixibon
deacb7df61 Fixed VScript files from Mapbase manifests not being loaded properly 2022-08-28 13:06:08 -05:00
Blixibon
392746f725 Fixed typo in vscript_server.nut 2022-08-28 13:03:59 -05:00
Blixibon
1cff3a2cd0 Fixed RPG readiness activities being marked as required 2022-08-06 14:46:34 -05:00
Blixibon
5369953d60 Fixed NPCs being unable to open doors with hardware not defined in the QC 2022-08-06 13:11:01 -05:00
Blixibon
8e90e6df58 Fixed commentary localization file not loading properly 2022-08-06 13:08:32 -05:00
Arbab Ahmed
a5770191bb use FLT_MAX instead of 1e+30, remove a busted two lines of code 2022-07-30 15:56:50 +10:00
Blixibon
9a939547c0 Fixed rare activity translation recursion case 2022-07-26 12:54:01 -05:00
Arbab Ahmed
fa3d686067 remove setabsorigin() code in serverside particle system 2022-07-25 23:43:58 +10:00
Arbab Ahmed
697b92ea35 add info_particle_system_coordinate, plus infinite cooldown functionality for prop_interactable similar to that of func_button 2022-07-25 13:07:43 +10:00
Blixibon
0cf49fbfa0 Fixed filter_script not functioning properly 2022-07-24 19:21:05 -05:00
Blixibon
636898fd79 Updated README 2022-07-23 00:31:07 -05:00
Blixibon
f43c4607f7 Removed BuildTransformations VScript hook for now 2022-07-23 00:30:29 -05:00
Blixibon
1f4d5b4361
Merge pull request #192 from samisalreadytaken/scripthooks
Script hooks fixes and script hook manager
2022-07-22 21:31:43 -05:00
samisalreadytaken
6e6bb4d639 Implement CScriptHookManager 2022-07-22 22:41:32 +03:00
samisalreadytaken
22f0b2c3cc Refactor script hook system 2022-07-21 17:48:30 +03:00
Blixibon
04cff632a3 Fixed leftover code causing issues in debug 2022-07-19 13:44:03 -05:00
Blixibon
197a9be59c Fixed response system support for escaped quotes causing backslashes to stop working 2022-07-17 20:17:48 -05:00
Blixibon
a9bd90f681 Fixed invalid look targets invalidating models 2022-07-17 18:32:30 -05:00
Blixibon
a4657d0cf1 Fixed a crash involving player +USE anims 2022-07-16 13:16:45 -05:00
Blixibon
fe518c9859 Fixed an oversight in CAI_BaseNPC::TranslateActivity 2022-07-16 12:03:56 -05:00
Blixibon
0615b367ca Two misc. fixes 2022-07-16 00:05:28 -05:00
Blixibon
5536021e4f Added SetSpeechTarget() for citizen heal/ammo concepts 2022-07-16 00:04:46 -05:00
Blixibon
ebf24e98e3 Fixed VS2013 compile error 2022-07-15 23:33:51 -05:00
Blixibon
f965afde16 Added support for directory-specific Mapbase manifests when using the "ADDON" path ID (disabled by default) 2022-07-15 23:33:23 -05:00
Blixibon
b6b0583550 Added precaching + logo colors to env_credits 2022-07-15 23:27:19 -05:00
Blixibon
fca05c8be9 Updated README 2022-05-04 21:00:01 -05:00
Blixibon
dc1eb02322 Clarified clientside SequenceLoops VScript function description 2022-05-04 20:59:18 -05:00
Blixibon
39ec4ee704 Fixed zombie serverside ragdoll gibs crashing when one of the models isn't valid 2022-05-04 20:52:21 -05:00
Blixibon
ad4adf90ca Fixed a typo 2022-05-04 20:50:44 -05:00
Blixibon
1143570f3e
Merge pull request #172 from samisalreadytaken/sq-typemask
vscript fixes and additions
2022-04-28 13:16:23 -05:00
Blixibon
e7c61320a5 Fixed misplaced cvars 2022-04-27 00:09:34 -05:00
Blixibon
d525ca02b8
Merge pull request #182 from Petercov/mapbase-feature/dynint-loader-enhancement
NPCs can load dynamic interactions from all animation MDLs
2022-04-26 14:44:18 -05:00
Blixibon
1f4f66fd28
Merge pull request #186 from Petercov/mapbase-feature/fix-teeth-shader
Fix for brightly glowing teeth
2022-04-26 14:40:17 -05:00
Blixibon
1d1caaf7cb
Merge pull request #185 from Petercov/mapbase-feature/enemyfinder-nodraw-fix
Fixed enemyfinders becoming visible when they wake
2022-04-26 14:39:18 -05:00
Blixibon
ea85fe20f6
Merge pull request #184 from Petercov/mapbase-feature/projtex-aspect-fix
Compute aspect ratios on shadow depth textures
2022-04-26 14:38:26 -05:00
Blixibon
e0821e404f Disabled NPC door activities by default and allowed mappers to enable them at their own discretion 2022-04-26 13:53:04 -05:00
Blixibon
b0689150e5 Added $envmapfresnel / $envmapfresnelminmaxexp without $phong + $allowdiffusemodulation, all from Alien Swarm SDK 2022-04-26 12:39:22 -05:00
Blixibon
6413647d23 Changed g_ai_ignore_graph_timestamps into a cvar which identifies maps from chapters.txt instead 2022-04-26 08:40:52 -05:00
Blixibon
e22bbc97fb Fixed two issues in the response system 2022-04-26 08:39:12 -05:00
Blixibon
714c89cc49 Added Matcher_ContainsWildcard and fixed an issue with lazy wildcards 2022-04-26 08:38:22 -05:00
Blixibon
033fd9662b Added new optional weapon activities for AR3, SMG3, and HMG1 2022-04-26 08:34:11 -05:00
Blixibon
32bbb0c231 Added missing parameters to function in new response code 2022-04-26 08:31:41 -05:00
Blixibon
08727cc322 Added custom model support and 'NoIdlePatrol' keyvalue to npc_hunter 2022-04-26 08:30:55 -05:00
Blixibon
4dbe8a7001 Added FIRE_BULLETS_NO_AUTO_GIB_TYPE 2022-04-26 08:08:56 -05:00
Blixibon
633e90fe16 Added GetNewlinePositions for vgui::TextImage 2022-04-26 08:05:47 -05:00
Blixibon
daa4779978 Small fixes for issues of various sizes 2022-04-26 08:04:54 -05:00
Blixibon
b04fb3c43f Added commentary footnotes, misc. commentary fixes 2022-04-26 07:55:35 -05:00
Peter Covington
d3978db574 Fixed custom gun not reseting zoom when holstered 2022-04-21 22:56:24 -04:00
Peter Covington
655212ee62 Fix for brightly glowing teeth 2022-04-20 16:58:45 -04:00
Peter Covington
a6a8a04b1f Fixed enemyfinders becoming visible when they wake 2022-04-20 09:41:26 -04:00
Peter Covington
37019140bd Fix 2022-04-20 04:05:34 -04:00
Peter Covington
31cd394cb7 More features for custom melee weapon 2022-04-20 03:41:32 -04:00
Peter Covington
fa41a327e7 Added a data cache to the custom weapons system 2022-04-20 01:48:32 -04:00
Peter Covington
a5ad82339e Compute aspect ratios on shadow depth textures 2022-04-19 21:07:58 -04:00
Peter Covington
d871c6f8fd Add Mapbase file headers 2022-04-19 03:16:54 -04:00
Peter Covington
0ae65a5a64 Fix weapon selection 2022-04-19 02:53:35 -04:00
Peter Covington
13f422f4c4 Fix issues 2022-04-19 00:57:05 -04:00
Peter Covington
179b7a5298 Added factory for bullet-firing guns 2022-04-18 23:46:23 -04:00
Peter Covington
ee46bc4bd1 Fixes 2022-04-18 18:12:40 -04:00
Peter Covington
e77180547d Readiness activities for custom melee weapon 2022-04-18 17:25:25 -04:00
Peter Covington
f58b599020 Fixed custom weapon scripts on client 2022-04-18 17:24:41 -04:00
Peter Covington
332856e37e Added factory for melee weapons 2022-04-18 15:09:57 -04:00
Peter Covington
749f9ffae0 Finished parser for vscript weapon 2022-04-17 15:57:37 -04:00
Peter Covington
7877953b6c Fixes 2022-04-16 09:18:06 -04:00
Peter Covington
5a0c406dbf Added an entity factory manager for custom weapons 2022-04-16 07:19:42 -04:00
Peter Covington
f9d88b15ac NPCs can load dynamic interactions from all animation MDLs 2022-04-15 09:59:17 -04:00
samisalreadytaken
493ff43ffe Add script consts: SERVER_DLL, CLIENT_DLL 2022-03-18 18:32:20 +03:00
samisalreadytaken
c28349daaf Add script funcs:
- CBaseAnimating::ResetSequenceInfo()
- CBaseAnimating::StudioFrameAdvance()
2022-03-18 18:32:00 +03:00
samisalreadytaken
f98445e33f Restrict vscript concommands 2022-03-18 18:30:00 +03:00
Blixibon
f8a8d49be7 Added GetViewModel function for VScript 2022-03-09 14:14:50 -06:00
Blixibon
e4d5d946d2 Fixed activator, caller, etc. values not working within RunScriptCode and related inputs 2022-03-09 14:14:12 -06:00
Blixibon
bb2478f342 Added VScript functions for giving/removing ammo 2022-03-09 14:12:28 -06:00
Blixibon
f79515fc11 Redid parts of backup activity system to support weapon act table recursion 2022-03-09 14:10:11 -06:00
Blixibon
670465dc58 Fixed companion melee damage not saving/restoring 2022-03-08 19:45:42 -06:00
Blixibon
dbb0ed6f46 Added gameinfo keyvalues for default hands models + code to hide custom hands on weapons which don't support them 2022-03-08 19:25:55 -06:00
Blixibon
2282aedfa6 Added weapon script keyvalues for unique dropped model and whether or not to use the separate hands model 2022-03-08 19:23:57 -06:00
Blixibon
2aa17fff22 Exposed Mapbase version integer to VScript 2022-03-08 19:14:53 -06:00
Blixibon
4f7cac8178 Added Mapbase version integer preprocessor 2022-03-08 19:03:53 -06:00
samisalreadytaken
5e444b2db9 Change CallClientScriptFunction UserMsg to EntityMsg 2022-03-06 18:46:00 +03:00
samisalreadytaken
f2f874939d Fix vscript global hook calls 2022-03-04 16:02:00 +03:00
samisalreadytaken
4af6d0cdaa Remove redundant script documentation 2022-02-26 19:20:00 +03:00
samisalreadytaken
700ac4ed78 Fixed memory leaks and unsafe code, reworked script CGameTrace 2022-02-26 19:15:00 +03:00
samisalreadytaken
9c942903e9 Remove CNetMsgScriptHelper multiplayer recipient functions 2022-02-18 17:04:00 +03:00
samisalreadytaken
6d3c53fe0f Fix writing multiple messages on client script NetMsg 2022-02-18 17:00:00 +03:00
samisalreadytaken
4b8f386c94 Clientside vscript additions:
Added C_BaseCombatCharacter script desc
Added boundary checks for script funcs
2022-02-12 19:35:00 +03:00
samisalreadytaken
0ae9c8bc8e Debug print script NetMsg names 2022-02-12 19:30:00 +03:00
samisalreadytaken
0afc503aff Add CSteamAPI::GetSteam2ID() 2022-02-12 19:25:05 +03:00
samisalreadytaken
236a9a1468 Set no instanceid warning print level 1 2022-02-11 20:10:00 +03:00
samisalreadytaken
439d3c75ab Fix VM stack corruption 2022-01-27 00:22:00 +03:00
Kirill GPRB
de8447dfc7
HexEdit particles.lib
Avoid _hypot being defined twice by renaming it to _STUB1
Taken from my own code at undnull/refraction#14
2022-01-27 01:26:07 +05:00
samisalreadytaken
aac91b6487 Set vscript integer param typemask to allow float 2022-01-19 18:39:59 +03:00
Blixibon
8d54443b6a Merge branch 'temp/speech-utilities' of https://github.com/Blixibon/source-sdk-2013 into develop 2022-01-17 19:12:46 -06:00
Blixibon
45191b97f8 Fixed incorrect ifdef preprocessor 2022-01-17 19:11:23 -06:00
Blixibon
abdd78e5e0 Merge branch 'temp/speech-utilities' of https://github.com/Blixibon/source-sdk-2013 into develop 2022-01-17 17:11:00 -06:00
Blixibon
ed21bb3d1d Added misc. speech/choreo utilities to ai_speech_new 2022-01-17 16:49:52 -06:00
Blixibon
06d2da3742 Added GetRealTimeSpeechComplete 2022-01-17 16:49:30 -06:00
Blixibon
f448be8c2b Added misc. speech/choreo utilities 2022-01-17 16:45:31 -06:00
Blixibon
ef19f1455d Fixed fake sequence gestures not identifying movement correctly 2022-01-17 16:39:25 -06:00
Blixibon
551de3fe19 Added CreateRopeWithSecondPointDetached function for VScript 2022-01-17 12:35:17 -06:00
Blixibon
4fdc0624a9 Added support for custom VScript procedural targets 2022-01-17 11:44:40 -06:00
Blixibon
2be559d50d Updated README and contribution guidelines 2022-01-15 13:09:19 -06:00
Blixibon
b113d189d6
Merge pull request #171 from samisalreadytaken/docsort
Add vscript documentation sorting
2022-01-15 12:14:33 -06:00
samisalreadytaken
9156ba84bd Add vscript documentation sorting 2022-01-14 22:47:00 +03:00
Blixibon
fa0f135c17
Merge pull request #170 from z33ky/mb/hl2-ragdoll-lru
Fix HL2 (non-episodic) build
2022-01-08 23:32:09 -06:00
Blixibon
271f158f79
Merge pull request #168 from samisalreadytaken/squirrel
Squirrel update
2022-01-08 23:31:58 -06:00
Blixibon
ea7a8cd565
Merge pull request #167 from samisalreadytaken/secfix
Security fixes
2022-01-08 23:31:39 -06:00
Blixibon
214f79ebbc Added two activity accessor functions for CAI_BaseNPC 2022-01-08 15:37:34 -06:00
Blixibon
125eb70a80 Added DisappearMinDist to func_lod for forwards compatibility 2022-01-08 15:36:33 -06:00
Blixibon
eb05dba580 Fixed env_credits logo not working properly 2022-01-08 15:34:36 -06:00
Blixibon
c1eae4a4f9 Added new weapon script values for viewmodel FOV override, bob scale, sway scale, and sway speed scale 2022-01-08 15:34:06 -06:00
samisalreadytaken
023512dcc3 Minor perf improvement in CScriptMaterialProxy 2021-12-26 18:33:53 +03:00
Alexander 'z33ky' Hirsch
192b6983ea Fix HL2 (non-episodic) build
Broke in cea38f03ec1834ac9f3ab60340746b308df872ec.
2021-12-25 11:26:15 +01:00
samisalreadytaken
6579e94305 Less memory usage in CScriptConCommand::CommandCompletionCallback 2021-12-22 16:10:00 +03:00
samisalreadytaken
0de9cf41eb Update Squirrel 2021-12-11 22:20:00 +03:00
Blixibon
c25053d1d2 Fixed a typo 2021-12-10 15:07:16 -06:00
Blixibon
483abff3b3 Added custom gameinfo.txt values for HL2 default player model + enabling external drawing by default 2021-11-27 15:48:51 -06:00
Blixibon
cea38f03ec Added support for ragdoll prop gibs + related ragdoll LRU forced fade from Alien Swarm SDK 2021-11-27 15:47:13 -06:00
Blixibon
4bc56b214b Fixed an issue with env_instructor_hint crashing in some maps 2021-11-22 23:03:55 -06:00
Blixibon
6b13b83231 Added ability to translate actbusy forced move activity translation 2021-11-22 23:03:26 -06:00
Blixibon
9b84980a77 Improved player backup activities 2021-11-22 23:02:37 -06:00
Blixibon
17e8558ca4 Added activity gesture links for some of the recently added activities 2021-11-21 11:01:38 -06:00
Blixibon
808ea9bb8c Fixed shared activity collisions involving the new unused weapon activities 2021-11-21 11:00:27 -06:00
Blixibon
1130a40d1e Added SetViewtarget function to VScript 2021-11-21 00:14:13 -06:00
Blixibon
79ff53ecdf Added support for NPCs with innate range attacks (e.g. vorts) in standoffs 2021-11-21 00:13:56 -06:00
Blixibon
4e3287842e Added optional new activities for unused HL2 weapons included in the Source SDK (deactivated by default) 2021-11-20 20:49:24 -06:00
Blixibon
d2fdfd3fe1 Changed activity preprocessors to use #if instead of #ifdef 2021-11-20 20:37:37 -06:00
Blixibon
5090c8b743 Fixed player +USE animation cvar aliasing issue 2021-11-20 20:33:27 -06:00
Blixibon
b24b1054aa Fixed func_commandredirect not cancelling orders correctly and rewrote its code/comments so that it doesn't appear to be bizarre nonsense 2021-11-20 20:32:46 -06:00
Blixibon
b3c3ecb8a5 Fixed player holster animation repeating 2021-11-20 01:02:41 -06:00
Blixibon
37c3cd5e1c Fixed bugbait player throw animation 2021-11-20 01:02:16 -06:00
Blixibon
fecddb3ecc Added player +USE animations 2021-11-20 01:01:52 -06:00
Blixibon
1d768e4816
Update sp/src/game/shared/mapbase/singleplayer_animstate.cpp
Co-authored-by: z33ky <1zeeky@gmail.com>
2021-11-19 13:35:00 -06:00
Blixibon
db0b51bf76 Fixed ForcePrimaryFire not working on RPG 2021-11-18 23:23:58 -06:00
Blixibon
013da89b27 Fixed issues with unique cases in companion readiness 2021-11-18 23:23:09 -06:00
Blixibon
7dab039099 Added unique annabelle activities and adjusted AI to better-handle the weapon 2021-11-18 23:21:28 -06:00
Blixibon
ebfd715843 Fixed a mistake in the README's referenced PRs 2021-11-18 20:31:37 -06:00
Blixibon
4ac5a2f331 Added recent PRs to README 2021-11-18 13:05:21 -06:00
Blixibon
049c513cce Clarified notes regarding new toolsets 2021-11-18 13:04:26 -06:00
Blixibon
751fa218e5
Merge pull request #163 from mapbase-source/feature/singleplayer-anim-state
Singleplayer animation state (full player model animations)
2021-11-18 11:13:39 -06:00
Blixibon
4d0ca13efb Renamed the new HL2:DM "357" activities to "REVOLVER" activities 2021-11-17 00:20:48 -06:00
Blixibon
dc6d4e0963 Applied even more player animations to SP HL2 weapons 2021-11-17 00:19:46 -06:00
Blixibon
045cc293f3 Removed some redundant singleplayer animation state code 2021-11-16 13:20:24 -06:00
Blixibon
1b1218f5fe Fixed singleplayer anim state reload not working 2021-11-16 10:27:24 -06:00
Blixibon
3a3d9a45b6 Made the singleplayer anim state able to apply render angles from the server 2021-11-16 10:27:01 -06:00
Blixibon
71e44f7198
Merge pull request #162 from z33ky/mb/vs2019-memoverride
Fix VS2019 _msize_base() exception specification
2021-11-15 23:38:58 -06:00
Blixibon
777f45a323 Added arm/disarm activities to gravity gun 2021-11-15 16:22:10 -06:00
Blixibon
450e6a2ff2 Implemented crossbow worldmodel bolt disappearance on player reload 2021-11-15 16:21:52 -06:00
Blixibon
f975e7d10d Changed the singleplayer animation state to only be active when the model has appropriate animations 2021-11-15 16:19:27 -06:00
Blixibon
91978b2934 Fixed issues with third person player models 2021-11-15 14:48:47 -06:00
Blixibon
abc34c0c85 Added holstered activity handling for players 2021-11-15 14:45:32 -06:00
Blixibon
41d799bbdf Added new player animation types and applied more player animations to SP HL2 weapons 2021-11-15 14:43:58 -06:00
Blixibon
6755a4d3f6 Added walking to singleplayer anim state 2021-11-15 14:40:51 -06:00
Blixibon
0139390c3e Added more HL2:DM activities 2021-11-15 14:39:54 -06:00
Blixibon
5855c634de Improved implementaton of player model activities on SP HL2 weapons 2021-11-15 01:02:12 -06:00
Blixibon
b9a46bc4e0 Added backup activities to players 2021-11-15 01:00:56 -06:00
Blixibon
2d5e6f4adb Ported the singleplayer anim state to CBasePlayerAnimState and fixed it up to use 9-way blends 2021-11-15 01:00:28 -06:00
Blixibon
2ca681431b Added experimental singleplayer anim state 2021-11-14 12:02:26 -06:00
Blixibon
72e846ec27 Fixed env_tonemap_controller keyvalues ignoring default values 2021-11-14 11:59:13 -06:00
Blixibon
61bbe331dd Fixed m_bDrawPlayerModelExternally drawing the weapon's viewmodel instead of its worldmodel 2021-11-14 11:58:11 -06:00
Blixibon
1c3b374d9e Fixed m_bDrawPlayerModelExternally causing the player's model to block flashlight shadows 2021-11-14 11:57:24 -06:00
Alexander 'z33ky' Hirsch
13ee304ce0 Fix VS2019 _msize_base() exception specification 2021-11-14 17:17:28 +01:00
Blixibon
76af96e3ae Added TranslateActivity VScript function to CAI_BaseNPC 2021-11-13 09:13:25 -06:00
Blixibon
7161dee1a3 Fixed a crash involving clientside ragdoll impact decals 2021-11-13 09:12:51 -06:00
Blixibon
301309f76b Added forgotten code from crossbow readiness activities 2021-11-11 19:07:35 -06:00
Blixibon
c1f28c4550 Added VScript functions for NPC crouching 2021-11-11 19:07:04 -06:00
Blixibon
5a8c6350bb Fixed some NPCs T-posing at medium crouch cover nodes 2021-11-11 19:06:45 -06:00
Blixibon
ad9e02885e Added crossbow readiness activities 2021-11-11 19:06:04 -06:00
Blixibon
4fbb9bc602 Added basic support for vortigaunts using the grenade AI from CNPC_PlayerCompanion 2021-11-11 19:05:09 -06:00
Blixibon
3d3ef7e587 Moved the new toolsets into their own VPC file so that projects are detected as stale 2021-11-11 12:29:17 -06:00
Blixibon
0d9fefb7dd Added experimental support for v140 (VS2015) toolset 2021-11-11 12:28:01 -06:00
Blixibon
aaeb5f5835 Added experimental support for v143 (VS2022) and v141 (VS2017) toolsets 2021-11-11 09:33:29 -06:00
Blixibon
49befe0f77 Updated README for v7.0 thus far 2021-11-09 14:53:46 -06:00
Blixibon
86a5ace57b Added proper keyvalue for combine_mine orientation 2021-11-07 17:38:59 -06:00
Blixibon
28c968ad4f
Merge pull request #159 from z33ky/mb/gcc-fixes
Fix gcc build errors & warnings
2021-11-07 17:18:40 -06:00
Blixibon
3a297d0d16 Added default parameter wrappers for PrecacheModel and PrecacheOther VScript functions 2021-11-07 17:10:02 -06:00
Alexander 'z33ky' Hirsch
e46dc3a2bd Fix gcc build errors & warnings 2021-11-07 22:54:48 +01:00
Blixibon
8652b31ed1 Fixed the new PrecacheModel/PrecacheOther VScript functions missing serverside parameters 2021-11-07 14:02:13 -06:00
Blixibon
c8f48407c1 Added plant orientation to combine_mine 2021-11-07 14:01:27 -06:00
Blixibon
188293b93c
Merge pull request #157 from mapbase-source/feature/autocubemap
"Autocubemap" utility
2021-11-07 11:49:30 -06:00
Blixibon
400d572c03 Added "autocubemap" utility 2021-11-07 09:44:46 -06:00
Blixibon
c27dac6f8e
Merge pull request #143 from Matty-64/master
VBSP Features for those who use Propper
2021-11-07 08:19:01 -06:00
Blixibon
4b295c17e8
Merge pull request #148 from samisalreadytaken/fixup
Minor fixup
2021-11-07 08:15:30 -06:00
Blixibon
2f8e920c3e Minor body lean fix from Alien Swarm SDK 2021-11-07 07:37:41 -06:00
Blixibon
7e96be39b2 Added support for nested instances relative to their parents, which is what Hammer uses to display them 2021-11-07 07:37:13 -06:00
Blixibon
b2116d07e9 Made VBSP's OnMapLoaded into a hook using the new system 2021-11-07 07:35:28 -06:00
Blixibon
653d48d2c4 Added ViewProximity and ViewDirection material proxies 2021-11-07 00:48:28 -05:00
Blixibon
e30bde782a Added clientside VScript functions for getting view position/direction 2021-11-07 00:47:52 -05:00
Blixibon
9ab5cb13e2
Merge pull request #156 from mapbase-source/feature/newer-toolsets
VS2019 toolset (v142) support
2021-11-07 00:45:00 -05:00
Blixibon
47a0bb0fde Moved toolset conditionals to a more fitting and intuitive place 2021-11-06 15:29:48 -05:00
Blixibon
c925a01712 Disabled phonemeextractor and QC_Eyes in VS2019 solution (for now) 2021-11-06 14:04:34 -05:00
Blixibon
47ed1914cc Fixed VS2013 attempting to compile VS2019 code 2021-11-06 14:03:05 -05:00
Blixibon
b1f64f7d21 Fixed v142 conflict with particles.lib (for now) 2021-11-06 13:47:55 -05:00
Blixibon
18b49c3778 Merge branch 'develop' of https://github.com/mapbase-source/source-sdk-2013 into feature/newer-toolsets 2021-11-06 12:18:08 -05:00
Blixibon
25a2bab5ce
Merge pull request #152 from z33ky/mb/gcc-fixes
Fix gcc build errors & warnings
2021-11-06 12:17:42 -05:00
Blixibon
2dbd04e3d6 Merge branch 'develop' into feature/newer-toolsets 2021-11-06 09:42:29 -05:00
Blixibon
3f9c5eba11
Merge pull request #155 from mapbase-source/feature/asw-sdk-effects-and-volumes
Alien Swarm SDK changes to effects and volumes
2021-11-06 09:39:46 -05:00
Blixibon
b22eb9fb06 Added fog_volume, trigger_tonemap, new color correction code, and various other related changes 2021-11-06 09:16:13 -05:00
Blixibon
35ca2ab5a6 Added filter keyvalue to npc_heli_avoidsphere 2021-11-06 00:07:06 -05:00
Blixibon
435b84f96b Merge branch 'develop' of https://github.com/mapbase-source/source-sdk-2013 into develop 2021-11-06 00:03:07 -05:00
Blixibon
17d8accd69 Fixed a few small issues with NPCs, etc. 2021-11-06 00:02:05 -05:00
Blixibon
03da4d6b58 Added cvar to ignore timestamps when checking whether or not to rebuild nodegraph, relying on internal map versions instead 2021-11-05 23:59:46 -05:00
Blixibon
49cb43d6e7 Added prop_dynamic I/O/KV and misc. prop code changes from the Alien Swarm SDK 2021-11-05 23:53:23 -05:00
Blixibon
0f3fd075c2 Implemented an OverrideMove VScript hook for NPCs 2021-11-05 23:41:19 -05:00
Blixibon
b7749dd92e
Merge pull request #154 from mapbase-source/feature/npc-animation-uprising
The "NPC Animation Uprising" (Code)
2021-11-05 23:37:33 -05:00
Blixibon
a6d5c079d3 For now, made unhidden npc_sniper translate idle to proper gun-holding activity 2021-11-05 22:18:20 -05:00
Blixibon
447c185079 Fixed metrocops not moving to attack 2021-11-05 22:14:29 -05:00
Blixibon
67d5d8b20c Added proper NPC melee activities 2021-11-05 22:13:53 -05:00
Blixibon
276d9ff24f Misc. fixes from prior NPC changes 2021-11-04 12:04:31 -05:00
Blixibon
6d48f52d12 Added weight blending for IK attachment rules 2021-11-04 12:00:56 -05:00
Blixibon
c3176b34d0 Integrated Reload_NPC into more animation events and changed weapon_crossbow to be able to use a bodygroup instead of a skin for the empty bolt 2021-11-04 09:30:28 -05:00
Blixibon
0ce4251ba3 Added support for NPC door opening activities and adjustable open distance 2021-11-04 09:27:30 -05:00
Blixibon
97a6934061 Changed Combine soldier code to reflect the new activity alias overhaul and standoff behavior changes 2021-11-04 08:48:55 -05:00
Blixibon
a2c2fe09d5 Added sequence check and backup activity fallback to companion NPC readiness activities 2021-11-04 08:45:10 -05:00
Blixibon
2c55c6cea7 Added a cvar to toggle companion NPCs being able to pick up weapons they couldn't use prior to Mapbase's animation changes 2021-11-04 08:44:18 -05:00
Blixibon
440c8b5121 Fixed an oversight with new weapon activities preventing NPC weapon pickup 2021-11-04 08:26:39 -05:00
Blixibon
847db9c3e3 Added AI hint radius from the Alien Swarm SDK as well as an all-new "hint weight" keyvalue 2021-10-28 00:01:29 -05:00
Blixibon
ece1a612ce Integrated custom cover hints into base AI movement code 2021-10-27 23:59:27 -05:00
Blixibon
dfa7e6c0c2 Added "fake sequence gestures" for NPCs, which play certain activities as gestures instead when the current animation needs to be preserved 2021-10-27 23:55:55 -05:00
Blixibon
26c05ee685 Integrated medium cover activities into standoffs and beyond 2021-10-27 23:49:22 -05:00
Blixibon
833f0b0823 Added a bajillion new activities 2021-10-27 17:10:31 -05:00
Blixibon
0e8b870e7d Re-enabled NPC gesture turning with a cvar to toggle it 2021-10-27 17:05:19 -05:00
Blixibon
2eb12bcd5d Fixed NPC death poses 2021-10-27 17:03:47 -05:00
Blixibon
65478e754d Added func_tank behavior to vortigaunts and Barney 2021-10-27 17:02:49 -05:00
samisalreadytaken
74d219add4 Fix buffer overflow exploit 2021-10-23 18:45:15 +03:00
samisalreadytaken
b2c0ab41c0 Fix format string vulnerabilities 2021-10-23 18:45:05 +03:00
Blixibon
a5c0091588 Fixed metrocop unholster behavior 2021-10-18 11:37:06 -05:00
Blixibon
3cd6f2e581 Allowed Alyx to fly properly 2021-10-18 11:33:01 -05:00
Blixibon
ade8fe0d02 Added yaw locking to climbing navigation 2021-10-18 11:27:20 -05:00
Alexander 'z33ky' Hirsch
c53070b322 Fix gcc build errors & warnings 2021-10-18 00:13:06 +02:00
Blixibon
1c6b0679f8 Fixed various NPC holster-related issues 2021-10-14 02:16:38 -05:00
Blixibon
3d5f73b8be Added new NPC climbing activities and improved climbing navigation AI 2021-10-13 16:17:46 -05:00
Blixibon
2638dd1d1c Added ThrowGrenadeGestureAtTarget input 2021-10-11 13:23:37 -05:00
Blixibon
a8f0af7925 Implemented misc. new activities 2021-10-10 20:09:32 -05:00
Blixibon
fcc815512f Implemented new activities on RPG, crowbar, stunstick, and citizen accessories 2021-10-10 20:07:55 -05:00
Blixibon
6490e89256 Implemented new pistol, 357, and crossbow activities 2021-10-10 20:06:30 -05:00
Blixibon
4cfa6dd22c Revisited Mapbase's custom shared activities and expanded HL2 weapon activities 2021-10-10 20:02:50 -05:00
Blixibon
b9f3ac03fa Redid the backup activity system so that individual weapons can choose which activity tables to fall back to 2021-10-10 19:56:40 -05:00
Blixibon
3431f21f4d Misc. NPC fixes 2021-10-10 19:51:49 -05:00
Blixibon
f63213afc3 Exposed npc_citizen to VScript and fixed SelectModel() arrangement oversights 2021-10-10 19:49:47 -05:00
Blixibon
046296569d Exposed CBaseAnimatingOverlay to VScript 2021-10-10 19:47:10 -05:00
Blixibon
138d6c52aa Ported some minor fixes from the Alien Swarm SDK 2021-10-10 19:41:42 -05:00
Blixibon
525e3214f2 Added global VScript hooks for entity creation/deletion 2021-10-10 19:35:04 -05:00
Blixibon
35f941d6d0 Fixed issues with hand viewmodels not working upon weapon holster + Added a way to set the hand viewmodel bodygroup 2021-10-09 15:09:48 -05:00
Blixibon
f880e95e47 Encapsulated m_bDrawPlayerModelExternally 2021-10-09 15:06:36 -05:00
Blixibon
cc32c62964 Fixed issues with particle precipitation clamping not working on spawn or being inconsistent for non-rain types 2021-10-09 15:05:28 -05:00
Blixibon
495d534307 Fixed trigger_fall not doing anything when landing in water 2021-10-09 15:04:10 -05:00
samisalreadytaken
7894c8ad87 Eliminate redundant code 2021-10-04 20:26:46 +03:00
samisalreadytaken
690299b39c Add missing documentation in vscript 2021-10-01 16:20:24 +03:00
samisalreadytaken
bf24798ee8 Uncomment debug code 2021-10-01 16:20:14 +03:00
samisalreadytaken
2fa658cd57 Re-add mistakenly removed wrappers 2021-10-01 16:20:04 +03:00
Blixibon
7702ce96d4 Fixed reloading for certain weapons on certain NPCs 2021-09-28 12:10:25 -05:00
Blixibon
6d04c46dc0 Added speed modifier to scanners and rollermines 2021-09-28 12:09:29 -05:00
Blixibon
a1bc5196f2 Standalone FileExists() function for VScript 2021-09-28 11:16:14 -05:00
Blixibon
5fa7648693 Added more VScript functions for CMapbaseSystem 2021-09-28 11:12:07 -05:00
Blixibon
15f4d582f2 Added SetScale input to func_fake_worldportal 2021-09-28 11:06:34 -05:00
Blixibon
f638009797 Exposed developer commentary nodes to VScript 2021-09-28 11:06:14 -05:00
Blixibon
78f7ae6b8d Added I/O to allow commentary nodes to change view control parameters mid-commentary 2021-09-28 11:04:27 -05:00
Blixibon
4f140abd19 Misc. commentary node stability changes, including the usage of HUD animation commands 2021-09-28 11:02:14 -05:00
Blixibon
da68635013 Fixed an issue with IsCombatItem() not being overridden in CItem 2021-09-28 10:59:30 -05:00
Blixibon
59825cb6c1 Added Mapbase RT cameras to mat_showcamerarendertarget and fixed the command's materials not being referenced 2021-09-25 14:28:44 -05:00
Blixibon
f61b933ed3 Fix for a crash which occurs when NPCs pick up a weapon the player is already holding 2021-09-25 14:27:11 -05:00
Blixibon
85097e119e Grenade/alt-fire item dropping for metrocops and player companions 2021-09-25 14:26:31 -05:00
Blixibon
24e6ab3767 Added logic_substring to VPC 2021-09-25 11:28:29 -05:00
Blixibon
6c8e54b31e
Merge pull request #147 from mapbase-source/feature/ragdoll-decal-fixes
Ragdoll decal fixes
2021-09-25 11:26:30 -05:00
Blixibon
416912d61b
Merge pull request #146 from mapbase-source/feature/real-fake-worldportals
func_fake_worldportal overhaul
2021-09-25 11:26:15 -05:00
Blixibon
84695e744d
Merge pull request #140 from moofemp/feature/logic-substring
Add logic_substring
2021-09-25 11:25:24 -05:00
Blixibon
d6822c66f9
Merge pull request #132 from z33ky/mb/breakablebrush_spawnobject
Fix console error on BreakableBrushes without spawnobject
2021-09-25 11:25:00 -05:00
Blixibon
4eae5f4e16 Fix flipped viewmodels not swinging, etc. correctly 2021-09-25 10:33:19 -05:00
Blixibon
394501826c Forgot to reflect CUserCmd VScript change in player.cpp 2021-09-25 10:31:20 -05:00
Blixibon
5998158ac2 OnItemDrop output for NPCs 2021-09-24 13:18:04 -05:00
Blixibon
256cdfb7af Refactored the way certain classes and structs are exposed to VScript to make the code less reliant on metamethods and reduce awkward code placement 2021-09-24 13:10:37 -05:00
Blixibon
5d484bfa5f Death ragdolls "steal" impact decals from final damage + clientside ragdolls already on the ground receive impact decals 2021-09-24 00:30:49 -05:00
Blixibon
f11d7e0be8 Added model instance snatching for serverside ragdolls (retains decals) 2021-09-24 00:26:51 -05:00
Blixibon
8341a65a89 C_BaseAnimating tracks both server and client ragdolls 2021-09-24 00:24:40 -05:00
Blixibon
14a2285862 Overhauled fake world portals to be more stable and much cleaner internally 2021-09-24 00:19:45 -05:00
Blixibon
f1bd6fcf81 Support for overriding HUD animations via map-specific scripts 2021-09-24 00:12:45 -05:00
Blixibon
8985ad2fe4 Support for map-specific HUD animations and HUD layout scripts 2021-09-24 00:11:18 -05:00
Blixibon
e39e1e0cca Added a separate "host_pitchscale" cvar which can override host_timescale's sound pitch scaling 2021-09-20 23:46:39 -05:00
Blixibon
fc93d736ee Added support for displaying multiple screen overlays at the same time 2021-09-20 22:38:49 -05:00
Blixibon
f278491d86 Fixed point_viewcontrol "Don't set player view" keyvalue not working properly 2021-09-20 22:10:34 -05:00
Blixibon
4d4296dac2 Added keyvalue to ai_goal_follow to enable normal memory discard duration 2021-09-20 22:07:16 -05:00
Blixibon
08dcf3ffff Fixed an accidental omission from the EmitSound_t hooks (particularly the code which actually runs them) 2021-09-20 15:30:16 -05:00
Blixibon
0368abaf29 Made VScript's enum registration use direct API functions to create constant tables instead of declaring them in string literal code 2021-09-19 21:09:25 -05:00
Blixibon
d629fac2b5 Fixed a VScript think function crash 2021-09-19 21:08:02 -05:00
Blixibon
97928611aa Removed CancelEventsByInput at the suggestion of its contributor 2021-09-19 21:04:31 -05:00
Blixibon
5896fb73c8 Fixed issue with EmitSound_t origin in VScript 2021-09-19 21:03:36 -05:00
Blixibon
62f4d6f872 Exposed EmitSound_t and related constants to VScript and added hooks for modifying an entity's emitted sounds on both the server and client 2021-09-19 14:52:18 -05:00
Blixibon
55e75529bb Added OnEntText VScript hook inspired by later Source games 2021-09-19 01:13:43 -05:00
Blixibon
ca80915b54 Fix for citizens not aiming the RPG laser dot correctly 2021-09-18 18:42:56 -05:00
Blixibon
80251f67ec Fixed metrocops not speaking standoff sentences correctly 2021-09-18 18:31:29 -05:00
Blixibon
e27f4df8e5 Added support for map-specific client schemes 2021-09-18 13:06:15 -05:00
Blixibon
0b96d525d5 New "custom font" command for closed captioning/subtitles 2021-09-18 11:48:24 -05:00
Blixibon
cbdc3b4de8 Added a way for commentary nodes to combine the speaker and print name so that the print name can be displayed to players 2021-09-18 11:46:46 -05:00
Matthew
4787ce01f3 Initial commit 2021-08-10 23:23:24 -07:00
Blixibon
0faa6d9b1a Added a way for commentary node progress bars and subtitles to appear at the same time 2021-07-31 14:47:10 -05:00
Blixibon
8e8c34f958 Added support for columns and images in outro env_credits and color overrides for both intro and outro env_credits 2021-07-31 03:02:08 -05:00
Blixibon
4e6f4cb2ea Added scene commentary nodes, which play the audio in full VCD files 2021-07-31 03:00:05 -05:00
MoofEMP
f1a8638a34 Move logic_substring.cpp to mapbase folder 2021-07-27 22:41:43 -04:00
Moofles
3e9d3deda2
Use AllocPooledString() to prevent memory leak in logic_substring
Co-authored-by: Spencer Brown <spencerb21@live.com>
2021-07-27 17:50:32 -04:00
MoofEMP
99a8bdcb37 Use a variable for input string length in logic_substring 2021-07-27 17:47:03 -04:00
MoofEMP
41cde5ccf7 Fix logic_substring behaviour with unexpected length/startpos values 2021-07-27 04:02:14 -04:00
MoofEMP
22557f3751 Add logic_substring 2021-07-27 04:02:13 -04:00
Blixibon
5a11d51db4 Fixed some issues with instanced response systems 2021-07-26 13:14:51 -05:00
Blixibon
2b1a8762bd Added I/O/KV to point_viewcontrol inspired by later games 2021-07-26 13:08:20 -05:00
Blixibon
04687e03e9 Fixed an issue with trigger_look LOS keyvalue 2021-07-26 13:07:33 -05:00
Blixibon
632bd3d0ba Added commentary node return speed scale 2021-07-26 13:06:20 -05:00
Blixibon
7fde10fef6 Fixed issue with text commentary label bounds upon first display 2021-07-24 18:29:14 -05:00
Blixibon
cc9f5ff7d6
Merge pull request #139 from mapbase-source/feature/commentary/text-nodes
Developer commentary text nodes and image nodes
2021-07-24 03:08:45 -05:00
Blixibon
4ab87250b2 Added screen height scaling for vgui_text_display 2021-07-24 01:54:04 -05:00
Blixibon
3656ea3082 Added map-specific closed captioning files 2021-07-24 01:52:38 -05:00
Blixibon
4957311523 Added Alyx gun readiness activities to weapon_pistol/weapon_357 and default walk/run activities to weapon_alyxgun 2021-07-24 00:39:36 -05:00
Blixibon
d9accd2d7a Fixed a compile error in sceneentity.cpp 2021-07-24 00:37:22 -05:00
Blixibon
eae3881a03 Made viewmodel_fov a non-cheat by default 2021-07-24 00:37:01 -05:00
Blixibon
2f4ea05c8a Added view target/position scales for commentary nodes 2021-07-24 00:36:05 -05:00
Blixibon
3ab83ba1c2 Added image commentary nodes and better scaling/positioning for the text commentary panel 2021-07-18 01:27:33 -05:00
Blixibon
f67a1b95e5 Updated text commentary nodes 2021-07-17 03:58:09 -05:00
Blixibon
20f29c5552 Added prototype for a new type of commentary node which displays text instead of playing audio 2021-07-17 00:32:56 -05:00
Blixibon
2bc8631db1 Merge branch 'develop' of https://github.com/mapbase-source/source-sdk-2013 into feature/newer-toolsets 2021-07-16 11:57:06 -05:00
Blixibon
2ffec5bbcf Fixed a critical issue with Mapbase's default HL2 FGD being incompatible with VBSP instancing 2021-07-16 11:56:13 -05:00
Blixibon
9b795b3c51 Added WIP v142 toolset support based on Source SDK 2013: Community Edition repo 2021-07-12 14:47:34 -05:00
Blixibon
7ce328cbb9 Merge branch 'develop' of https://github.com/mapbase-source/source-sdk-2013 into develop 2021-07-12 14:37:00 -05:00
Blixibon
24c03f45c2 Added a cvar which allows antlions to be properly ignited instead of dying immediately 2021-07-12 14:36:39 -05:00
Blixibon
1b534af69d Made a bunch of static movement cvars editable in-game 2021-07-12 14:35:43 -05:00
Alexander 'z33ky' Hirsch
7ad12764fa Fix console error on BreakableBrushes without spawnobject 2021-07-03 13:12:31 +02:00
Blixibon
37099741a1
Merge pull request #130 from z33ky/mb/scene.image-parse-fixes
Fix scene loading memory errors
2021-07-02 12:01:44 -05:00
Alexander 'z33ky' Hirsch
b41d49c639 Fix scene file loading memory errors
Fixes leaks.
Also safeguards against deallocated pointers by doing
g_TokenProcessor.SetBuffer(NULL) after parsing is done - an access at
NULL should be easier to debug than at some random address, potentially
just reading in garbage data.
2021-07-02 09:27:25 +02:00
Blixibon
bb95574ad6
Merge pull request #131 from z33ky/mb/targeted-projected_texture
Initialize all basis vectors for env_projectedtexture with target
2021-06-29 14:31:05 -05:00
Blixibon
5bc783b381
Merge pull request #118 from z33ky/mb/develop
Two small fixes
2021-06-29 14:30:03 -05:00
Blixibon
29635bac52 Added experimental support for map-specific surfaceproperties scripts 2021-06-28 23:59:36 -05:00
Blixibon
0fb0a3319c Added misc. new VScript hooks/constants and the code required to implement them 2021-06-28 23:55:42 -05:00
Blixibon
29075a2c90 Added experimental static/global VScript hooks not tied to any particular class, starting with the integration of OnSave/OnRestore 2021-06-28 23:51:24 -05:00
Blixibon
ea7d1afa08 Fixed a few minor mistakes and aliasing oversights 2021-06-28 21:07:30 -05:00
Blixibon
5f42182c45 Divided mapbase_version cvar into server, client, and game_shader_dx9 counterparts 2021-06-28 20:04:23 -05:00
Alexander 'z33ky' Hirsch
e989cf63c5 Fix ReadFileEx() arguments when loading scene files
The parser expects NUL terminated data.
2021-06-06 16:11:24 +02:00
Alexander 'z33ky' Hirsch
f6a750e4b3 Initialize all basis vectors for env_projectedtexture with target 2021-06-06 15:52:35 +02:00
Alexander 'z33ky' Hirsch
06c7f7040d Fix env_instructor_hint from disappearing after savegame load
It is a bit unfortunate that the initial animation plays again after
load. This is likely not fixable with SDK code without reimplementing
the HUD bits, which are part of the external engine code.

Also adds a destructor override, since we are dealing with a polymorphic
class.
2021-05-27 23:42:31 +02:00
Blixibon
7d2970eacd Updated README with latest contribution PRs 2021-05-27 14:22:43 -05:00
Blixibon
0f2b08f238
Merge pull request #121 from mapbase-source/feature/vscript/hook-handler-prototype-1
Flexible hook handler
2021-05-27 13:19:13 -05:00
Blixibon
e52835520c Slightly adjusted hook callback code 2021-05-27 13:16:55 -05:00
Blixibon
0d9a5349b0 Merge branch 'develop' into feature/vscript/hook-handler-prototype-1
# Conflicts:
#	sp/src/vscript/vscript_squirrel.nut
2021-05-27 12:07:43 -05:00
Blixibon
1de46132d8 Slightly adjusted some prior changes 2021-05-27 12:02:39 -05:00
Blixibon
e28813de7f Added console message for when VScript documentation is requested while it's disabled 2021-05-27 12:01:55 -05:00
Blixibon
adada8f56e Made env_global_light start using different cvars for shadow map resolution and filter size 2021-05-27 11:41:52 -05:00
Blixibon
dcd7b95b62 Added new move_rope/keyframe_rope inputs 2021-05-27 11:39:47 -05:00
Blixibon
764f0c09e1
Merge pull request #124 from z33ky/mb/gcc11
Fix memory errors
2021-05-27 10:50:27 -05:00
Blixibon
be71cb487f
Merge pull request #122 from samisalreadytaken/cleanup
Minor adjustments
2021-05-27 10:49:46 -05:00
Blixibon
3287643c24 Added a few more matrix-related functions for VScript 2021-05-27 09:53:48 -05:00
Blixibon
c48428b678 Added OnEntrySequence and OnActionSequence for scripted_sequence 2021-05-27 09:53:31 -05:00
Blixibon
7a87bfdf5e Added ConVar material proxy 2021-05-27 09:52:28 -05:00
Alexander 'z33ky' Hirsch
78ef9f2019 Fix MapEdit memory errors
deleteThis() was called on NULL pointers.
Deleting individual nodes shouldn't be necessary if the whole structure
(pkvFile) is deleted anyways.
2021-05-23 12:11:26 +02:00
Alexander 'z33ky' Hirsch
098486fbe4 Fix pointer comparisons 2021-05-23 12:11:12 +02:00
Blixibon
8ad19cbf0a Reworked the OnDeath VScript hook so it could cheat death properly 2021-05-11 11:17:06 -05:00
Blixibon
6f515a2d34 Added VScript functions for bone attachments and transforming bone matrices 2021-05-11 10:46:30 -05:00
Blixibon
6392d9ab7c Added various misc. stubs and utility code from the Alien Swarm SDK 2021-05-11 10:45:48 -05:00
Blixibon
051a217670 Added proper ACT_IDLE_ON_FIRE handling for Combine soldiers 2021-05-11 10:14:39 -05:00
Blixibon
0bd1f5fb59 Fixed NPCs with death animations extinguishing their fires before they should be extinguished 2021-05-11 10:12:37 -05:00
Blixibon
184be1a794 Added a way to override climb node lineup linkage via target node keyvalue 2021-05-11 10:10:44 -05:00
samisalreadytaken
c62d86e340 Added developer check on script documentation registration 2021-05-10 00:05:08 +03:00
Blixibon
c37f8eefb7 Revisited hook handler based on suggestions and new information 2021-05-09 11:34:38 -05:00
samisalreadytaken
3b51405cac Minor adjustments and cleanup 2021-05-08 15:16:59 +03:00
Alexander 'z33ky' Hirsch
b95c72eb3f Fix viewmodel flip on zoom
The fabs() was incorrectly applied only to the viewmodel's FOV instead
of the result of that subtracted by the FOV offset.

Further it doesn't seem to make sense to use the absolute value of that
subtraction; Yes, it does prevent flipping, but it will zoom out again
as the FOV decreases.
Instead just limit the result of the subtraction to non-negative
numbers.
2021-04-29 18:36:58 +02:00
Blixibon
8bf258eb75 Updated README to reflect recent contributions 2021-04-27 11:08:46 -05:00
Blixibon
59cb73d1c1 Clarified what happens when the contributing guidelines are violated 2021-04-27 11:08:17 -05:00
Blixibon
3cd50a6ed4 Added sound pitch scaling and env_microphone detection for sentences 2021-04-27 10:59:39 -05:00
Blixibon
54c43dd6ce Fixed unreliable string pointer in CLogicPlayerProxy::AcceptInput() 2021-04-27 10:55:33 -05:00
Blixibon
0f6fd0a5a4
Merge pull request #117 from z33ky/mb/gcc-linux
gcc/Linux update
2021-04-26 20:47:46 -05:00
Alexander 'z33ky' Hirsch
d0b6998637 Simplify CBreakableGibShooter::GetRandomTemplateModelIndex
MapEntity_ExtractValue(), as opposed to CEntityMapData, does not require
a mutable string.
2021-04-26 09:44:12 +02:00
Alexander 'z33ky' Hirsch
036fbda906 Fix strdup() leaks 2021-04-26 09:26:21 +02:00
Alexander 'z33ky' Hirsch
a75b0b7d58 Fix spacing 2021-04-25 23:06:19 +02:00
Alexander 'z33ky' Hirsch
dddcf642aa Fix gcc build errors & warnings 2021-04-25 23:06:19 +02:00
Blixibon
5e2d1cccca
Merge pull request #116 from Alivebyte/master
Sound support for vgui_movie_display
2021-04-25 14:27:24 -05:00
Alivebyte
5782574711 Added constructor for movie_display to mute sound by default 2021-04-25 18:56:49 +03:00
Alivebyte
5bc2d7cb83 Added missing movie_display.cpp 2021-04-25 17:35:45 +03:00
rzkid
f458ac1223 removed stopallsounds 2021-04-25 17:27:26 +03:00
Alivebyte
ae4e26f03b Added sound support for vgui_movie_display 2021-04-25 15:48:29 +03:00
Blixibon
5eda2f692f Had to change mat_slopescaledepthbias_shadowmap back to 16 due to issues with objects like citizens looking strange up close 2021-04-24 11:47:41 -05:00
Blixibon
a92ca7ceac Added weakref() and getclass() for Vector and other C++ instances in VScript 2021-04-24 11:44:51 -05:00
Blixibon
7f423759d5 Added new and experimental clientside worldlight iteration method 2021-04-23 22:58:16 -05:00
Blixibon
425057453b Fixed an issue with the ForceThisNPCToStopBusy input which caused NPCs to keep acting busy when they shouldn't 2021-04-23 22:57:11 -05:00
Blixibon
45ca64863a Increased ragdoll element limit from 24 to 32, reflecting later branches of Source 2021-04-23 22:55:52 -05:00
Blixibon
200001fdb9 Fixed a couple obscure crashes 2021-04-23 22:54:20 -05:00
Blixibon
2a24e9782c Removed duplicate custom command overridables 2021-04-23 22:52:17 -05:00
Blixibon
ea98b2cd1a
Merge pull request #114 from samisalreadytaken/dev6
vscript additions
2021-04-23 22:31:04 -05:00
Blixibon
46b6f456af Updated README and mapbase_version for v7.0 2021-04-23 10:33:42 -05:00
Blixibon
bb030629bb Misc. shader adjustments 2021-04-23 10:23:53 -05:00
Blixibon
69fa4a0064 Fixed SetBloomScaleRange's syntax bug (although it seems the feature itself remains unfinished) 2021-04-23 10:21:40 -05:00
Blixibon
60aacf6df7 Added more overridable commands for VScript 2021-04-23 10:05:06 -05:00
Blixibon
e5ffd26fda Added ability to disable console groups from the scripts 2021-04-23 10:04:23 -05:00
Blixibon
ee8bee588a Added "Always transmit to client" flag for info_target 2021-04-23 00:25:02 -05:00
Blixibon
591572cfda Added properly overridden projected texture shadow depth bias cvar values 2021-04-23 00:20:57 -05:00
Blixibon
62a6481d0d Added default game_text speech color for every major HL2 character 2021-04-23 00:17:08 -05:00
Blixibon
bb250dbae6
Merge pull request #112 from ReDucTor/vscript-fix-bad-restore
Fixing bug with vscript restore cache not updating soon enough
2021-04-22 12:55:24 -05:00
Blixibon
caaf8836a4 Made VScript data variant returned in function stubs free itself 2021-04-22 11:37:46 -05:00
Blixibon
4cf360b259 Fixed zombie torso ragdolls not using the original zombie skins 2021-04-22 11:28:24 -05:00
Blixibon
48508c4e5c Added customizable bucket names for the new response system 2021-04-22 11:25:49 -05:00
Blixibon
4a07831c1a Removed some old comments 2021-04-22 11:23:08 -05:00
Blixibon
c5ed394330 Added console group for the Response System 2021-04-22 11:14:18 -05:00
Blixibon
15d04c0b9b Reworked Mapbase console groups to use script files and separate server/client commands instead of cvars and tier1 commands 2021-04-22 11:12:29 -05:00
Blixibon
ebec14d2b6 Restored unused port of Alyx combat AI speech concepts for all player companions 2021-04-22 01:39:59 -05:00
Blixibon
0b14f5fbcc Added convar to change weapon pickup autoswitch behavior 2021-04-22 01:38:52 -05:00
Blixibon
30bc88375a
Merge pull request #108 from mapbase-source/feature/asw-response-system
Alien Swarm SDK Response System
2021-04-21 16:54:17 -05:00
Blixibon
e31c45dee3 Merge branch 'develop' into feature/asw-response-system
# Conflicts:
#	sp/src/game/server/server_mapbase.vpc
2021-04-21 16:51:36 -05:00
Blixibon
62c6c3cb6b Fixed apparent buffer over-read in SDK_LightmappedGeneric 2021-04-21 15:19:49 -05:00
Blixibon
8b699441e9 Added VScript functions for ropes 2021-04-21 15:17:47 -05:00
Blixibon
fc9d699fed Changed VScript custom file read method and increased the max size to 64 MB 2021-04-21 15:13:54 -05:00
Blixibon
491b258f70 Fixed Vector unary minus operator modifying the instance itself 2021-04-21 15:09:52 -05:00
Blixibon
b718f19d45 Fixed VScriptProxy not working without a renderable and added a GetVarName function 2021-04-21 15:01:50 -05:00
Blixibon
138a25c53c Added custom core ball shader 2021-04-21 14:58:51 -05:00
Blixibon
f580801a33 Added I/O/KV for custom healthkits, custom battery models, and health/power multipliers 2021-04-21 10:53:48 -05:00
samisalreadytaken
d7a06e863e Fix ScriptContextThink precision errors 2021-04-18 18:43:05 +02:00
James Mitchell
9510c03ab3 Fixing bug with vscript restore cache not updating soon enough 2021-04-11 08:38:02 +10:00
Blixibon
d4311587c3
Merge pull request #95 from z33ky/gcc-linux
gcc/Linux update
2021-04-07 17:40:17 -05:00
Blixibon
1a6f1f0cab Replaced expresser cases involving CBaseMultiplayerPlayer with CBasePlayer to allow singleplayer expressers to be obtained 2021-04-07 13:53:06 -05:00
Blixibon
bec712f3f9 Made followup sources attributable by classname 2021-04-07 13:51:17 -05:00
Blixibon
80c26ea186 Fixed new response system sometimes crashing on rule lookup when the system is reloaded by rr_reloadresponsesystems or map-specific talker files 2021-04-07 13:50:05 -05:00
Blixibon
aa4d02fcbf Added NoteSpeaking and game_text mode for print responses 2021-04-07 13:46:26 -05:00
Alexander 'z33ky' Hirsch
28e87ce3d2 Fix/Implement VScript FFI for GCC's virtual member functions 2021-03-20 19:21:53 +01:00
Alexander 'z33ky' Hirsch
761f065d55 Fix stdshaders compilation on Linux 2021-03-20 14:56:46 +01:00
Alexander 'z33ky' Hirsch
e0091261ed Fix Buttons not working on Linux with newer gcc
The button mask is created by shifting a bit according to the
MouseCode, which is just a renamed ButtonCode_t.
Mouse buttons start at 107, which is way out of range for our ints.

To fix this, introduce MouseButtonBit(), which checks if a button code
corresponds to a mouse button at all and returns a usable bitmask
for the corresponding mouse button code.
This is then used for the button mask.
2021-03-20 13:58:23 +01:00
Alexander 'z33ky' Hirsch
718186f165 Specify gcc9+support.cpp dependency for gcc8+ Makefiles 2021-03-19 17:41:27 +01:00
Alexander 'z33ky' Hirsch
a5fb07d6ac Fix gcc9+support.o compilation 2021-03-19 17:41:27 +01:00
Alexander 'z33ky' Hirsch
49836ab50a Fix gcc build errors & warnings 2021-03-19 17:41:27 +01:00
Blixibon
38be2ca932 Merge branch 'feature/vscript/hook-handler-prototype-1' of https://github.com/mapbase-source/source-sdk-2013 into feature/vscript/hook-handler-prototype-1 2021-03-19 09:45:14 -05:00
samisalreadytaken
6ed8b31091 vscript additions:
- Added CBaseEntity::Activate
   - Added CBaseEntity::SetSolid
   - Added CBaseEntity::GetSolid
   - Added C_BaseEntity::UpdateOnRemove

   - Added hook behaviour on CScriptConCommand
   - Added more script overridable concommands
   - Added CScriptConvarAccessor::SetChangeCallback
   - Added CScriptGlowObjectManager
   - Added CScriptSteamAPI
2021-03-19 16:44:12 +02:00
Blixibon
8bcb6263f5 Misc. response system code cleanup/QOL changes 2021-03-18 00:34:31 -05:00
Blixibon
a05503e42b Fixed rr_disableemptyrules not always working correctly 2021-03-18 00:33:35 -05:00
Blixibon
4e09f4bdf5 Added rr_disableemptyrules cvar, which prevents rules from being selected again after their norepeat/speakonce responses are exhausted 2021-03-17 16:55:54 -05:00
Blixibon
4b8da761ce Added base Mapbase matchers to tier1 so that the response system library can access them 2021-03-17 16:50:24 -05:00
Blixibon
4d3f51a720 Fixed a compile error from when NEW_RESPONSE_SYSTEM is disabled 2021-03-17 10:45:31 -05:00
Blixibon
264ee2b04f
Merge pull request #110 from mapbase-source/develop
Mapbase v6.3
2021-03-16 18:29:36 -05:00
Blixibon
ec995b68c9 Added keyvalue/input to set suit zoom FOV in logic_playerproxy 2021-03-15 21:37:02 -05:00
Blixibon
58bc8b7101 Added save/load command overrides for VScript 2021-03-15 21:31:12 -05:00
Blixibon
c66e9c78a0 Added keyvalues for controlling func_rotating min/max sound pitch 2021-03-14 16:33:18 -05:00
Blixibon
a1332a442d Added volume scale to env_microphone 2021-03-14 13:49:10 -05:00
Blixibon
4884d02481 Fixed spelling errors of "Receive" in the NetMsg VScript singleton 2021-03-14 13:48:21 -05:00
Blixibon
fb30f64d30 Updated README and mapbase_version for v6.3 2021-03-14 00:04:04 -06:00
Blixibon
e9cc3cb134
Merge pull request #109 from mapbase-source/feature/vgui-text-display
vgui_text_display (point_worldtext-like text entity)
2021-03-13 16:49:54 -06:00
Blixibon
4f7793ae12 Added a missing shutdown call from VGui movies/video code 2021-03-13 16:47:18 -06:00
Blixibon
3579404668 Added FireEvent hook to clientside VScript (equivalent of HandleAnimEvent) 2021-03-13 16:46:29 -06:00
Blixibon
6cfcc66cec Added halo scale and custom material keyvalues to point_spotlight 2021-03-13 16:45:20 -06:00
Blixibon
2fbef62553 Fixed a crash on exit involving the presence of multiple VGui screen manifests and a possibly defunct memory leak fix 2021-03-13 16:44:28 -06:00
Blixibon
303b0552e9 Touched up vgui_text_display code, added Toggle input 2021-03-13 16:42:47 -06:00
Blixibon
3bb9a92ed8 Added hook for CBaseAnimating::HandleAnimEvent() 2021-03-12 15:33:48 -06:00
Blixibon
97116a5eca Exposed npc_sniper to VScript 2021-03-12 15:19:36 -06:00
Blixibon
8d807b5b0b Exposed CAI_BaseNPC::GetActualShootPosition() and related functions to VScript 2021-03-12 15:18:37 -06:00
Blixibon
92ec640db3 Added vgui_screens_mapbase.txt to level init process for loading shared VGui screens 2021-03-12 15:07:05 -06:00
Blixibon
7221aab090
Merge pull request #107 from mapbase-source/feature/asw-movies
Alien Swarm SDK videos and movies
2021-03-12 11:32:06 -06:00
Blixibon
d953468bc1 Fixed env_credits always resetting sv_unlockedchapters to 15 when it shouldn't 2021-03-12 11:08:39 -06:00
Blixibon
36a459d21c Fixed a crash related to VScript custom console commands 2021-03-12 11:06:46 -06:00
Blixibon
c7657b1547 Fixed a crash related to an obscure choreo event 2021-03-12 11:04:56 -06:00
Blixibon
9432ecc40c Added new "mute" keyvalue and StopMovie input to logic_playmovie 2021-03-12 10:15:09 -06:00
Blixibon
c17d32d7a4
Merge pull request #105 from samisalreadytaken/dev3
vscript additions and fixes 3
2021-03-11 02:36:53 -06:00
Blixibon
57774c2a79 Added vgui_text_display, an entity which displays a VGui text label oriented in the world 2021-03-10 12:07:55 -06:00
Blixibon
e10a4d6613 Added VScript file response to base response dispatch code 2021-03-10 02:11:39 -06:00
Blixibon
24ac080608 Added legacy response context operators 2021-03-10 02:10:22 -06:00
Blixibon
8966462fee Stabilized implementation of some Mapbase code in the new response system 2021-03-09 12:39:13 -06:00
Blixibon
efec7ab4db Added Mapbase's enhanced save/restore to new response system + moved aound rr_dumphashinfo code so that it has access to default response system 2021-03-09 12:37:08 -06:00
Blixibon
8033c0dad4 Fixed response group default params, which seem to have been broken in vanilla response system code from the SDK 2021-03-09 12:30:48 -06:00
Blixibon
d4a91fe027 Made followup responses more reliable with generic NPCs and added "vscript_file" response type 2021-03-09 10:03:40 -06:00
Blixibon
d6b959899c Missed a file in the initial Response System library port commit 2021-03-08 02:12:53 -06:00
Blixibon
d081a0cee3 Added prototype Response System library port from the Alien Swarm SDK 2021-03-08 02:11:13 -06:00
Blixibon
251725c987 Added semi-standardized custom model support to several NPCs 2021-03-07 12:03:32 -06:00
Blixibon
92866ca2fa Added EnableCrouch input to npc_strider 2021-03-07 11:57:33 -06:00
Blixibon
8f7d3ac03b Added keyvalue to combine_mine for disabling companion avoidance 2021-03-07 11:55:08 -06:00
Blixibon
15ae789b89 Added "Disable flashlight" keyvalue/inputs inspired by Portal 2's 2021-03-07 11:43:28 -06:00
Blixibon
c4abb0b07f Made HUD movie parameters more flexible; Added WIP movie fade effects for replicating the Portal 2 keyvalues 2021-03-07 11:39:50 -06:00
Blixibon
a4a292975b Added logic_playmovie and vgui_movie_display from Alien Swarm SDK 2021-03-06 01:16:00 -06:00
Blixibon
302885d39c Added video panel code from Alien Swarm SDK + custom looping support 2021-03-06 01:13:49 -06:00
samisalreadytaken
bf182e1c5d vscript additions and fixes:
baseentity_shared.cpp
baseentity.cpp
c_baseentity.h
c_baseentity.cpp
c_world.h
   - Fixed critical ScriptSetContextThink bugs
   - Added C_BaseEntity::SetContextThink (ScriptSetContextThink)
   - Added C_BaseEntity::SetSize
   - Added C_BaseEntity::SetModel
   - Added C_BaseEntity::Destroy

baseentity.h
baseentity.cpp
   - Removed duplicate functions ScriptSetSize and ScriptUtilRemove

player.cpp
   - Moved player script instance registration before player_spawn event

vscript_server.cpp
   - Added CEntities::FindByClassNearestFacing

vscript_funcs_shared.cpp
   - Added GetFrameCount
   - Added IntervalPerTick

vscript_singletons.cpp
   - Better game event descriptors for CScriptGameEventListener
   - Added ::effects (CEffectsScriptHelper)
   - Added ::Convars (CScriptConvarAccessor)

vscript_shared.cpp
   - Fixed clientside entity printing in script VM

mapbase_con_groups.h
mapbase_con_groups.cpp
   - Improved performance by changing string comparisons to direct array access

vscript_bindings_base.h
vscript_bindings_base.cpp
   - Added CScriptKeyValues::SubKeysToTable

vscript_bindings_math.cpp
   - Added ::SimpleSplineRemapVal
   - Added ::SimpleSplineRemapValClamped
   - Added ::Bias
   - Added ::Gain
   - Added ::SmoothCurve
   - Added ::SmoothCurve_Tweak
   - Added ::ExponentialDecay

vscript_squirrel.nut
   - Added ::Lerp
   - Added ::FLerp
   - Added ::SimpleSpline

vscript_squirrel.cpp
   - Added Vector::_unm
   - Added Vector::Set
   - Added Vector::Add
   - Added Vector::Subtract
   - Added Vector::Multiply
   - Added Vector::Divide
   - Added Vector::DistTo
   - Added Vector::DistToSqr
   - Added Vector::IsEqualTo
   - Added Vector::WithinAABox
   - Added Vector::FromKVString
   - Changed vector print syntax
2021-03-06 02:04:55 +02:00
Blixibon
bd3b9c3807 Fixed VBSP VScript documentation not working 2021-03-04 11:37:32 -06:00
Blixibon
201a7ad1d1 Added prototype VScript hook handler 2021-02-24 12:01:50 -06:00
528 changed files with 50997 additions and 4765 deletions

View File

@ -23,17 +23,40 @@ All contributions must follow the following rules:
is usually not fit for Mapbase.
* All content in a contribution must be either already legally open-source or done with the
full permission of the content's original creator(s).
full permission of the content's original creator(s). If a license is involved, the contributor
should ensure Mapbase conforms to its terms.
* **NOTE:** Due to concerns with mods which do not wish to be open-source, content using GPL licenses (or any
license with similar open-source requirements) are currently not allowed to be distributed with Mapbase.
Contributions which can draw from them without actually distributing the licensed content may be excepted
from this rule.
* Contributions must not break existing maps/content or interfere with them in a negative or non-objective way.
* Code contributions are not obliged to follow Mapbase's preprocessor conventions (e.g. #ifdef MAPBASE),
although following them is usually acceptable.
* Code contributions which modify or add onto existing code should generally match its syntax and shouldn't
change the spacing unless necessary.
* If you are contributing a file you created yourself specifically for Mapbase, you are required to
use the custom "Mapbase - Source 2013" header used in other Mapbase files as of Mapbase v5.0.
You are encouraged to append an "Author(s)" part to that header in your file in order to clarify who wrote it.
* Do not modify the README to add attribution for your contribution. That is handled by Mapbase's maintainers.
Contributions which do not follow these guidelines cannot be accepted into Mapbase. Attempting to contribute content
which seriously violates the rules above can lead to being blocked from contributing, especially if done repeatedly.
---
Mapbase uses GitHub Actions to help manage issues and pull requests. Some of these workflows build the code of incoming
contributions to make sure they compile properly. The code is compiled separately for Visual Studio 2022 and GCC/G++ 9 (Linux)
and on both Debug and Release configurations.
If these workflows fail, don't freak out! Accidents can happen frequently due to compiler syntax differences and conflicts
from other contributions. You can look at a failed workflow's log by clicking "Details", which will include the build's output
in the "Build" step(s). Any errors must be resolved by you and/or by code reviewers before a pull request can be merged.
If your contribution is accepted, you may be listed in Mapbase's credits and the README's external content list:
https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Credits#Contributors
https://github.com/mapbase-source/source-sdk-2013/blob/master/README

35
.github/labeler.yml vendored Normal file
View File

@ -0,0 +1,35 @@
#
# MAPBASE REPO AUTOMATION
#
# Automatically labels pull requests according to changed file paths.
# See mapbase_pr.yml for more information.
#
Repo:
- '*'
- '.github/**'
Project Generation:
- '**/src/vpc_scripts/**'
- '**/src/devtools/**'
- '**/src/create*'
Entities:
- '**/src/game/**/**logic**'
- '**/src/game/**/**point**'
Shaders:
- '**/src/materialsystem/**'
VScript:
- '**vscript**'
Tools:
- '**utils**'
NPCs:
- '**npc_**'
- '**ai_**'
VGUI:
- '**hud_**'
- '**vgui_**'

View File

@ -0,0 +1,70 @@
#
# MAPBASE SOURCE 2013 CI
#
# This can be used to manually build the codebase.
#
# See mapbase_build-base.yml for more information on how this works.
name: Build Projects (Manual)
on:
workflow_dispatch:
inputs:
configuration:
description: 'Which configuration to build with'
default: 'Release'
required: true
type: choice
options:
- Release
- Debug
branch:
description: 'Which Source 2013 engine branch to compile for'
default: 'sp'
required: true
type: choice
options:
- sp
- mp
game:
description: 'Name of the game to build (if relevant)'
default: 'episodic'
required: false
type: choice
options:
- episodic
- hl2
project-group:
description: 'Which group of projects to compile'
required: true
type: choice
options:
- all
- game
- shaders
- maptools
solution-name:
description: 'Name of the solution/makefile'
required: true
type: choice
options:
- everything
- games
- shaders
- maptools
build-on-linux:
description: 'Build on Ubuntu/Linux?'
default: true
required: false
type: boolean
jobs:
build_manual:
uses: ./.github/workflows/mapbase_build-base.yml
with:
configuration: '${{ github.event.inputs.configuration }}'
branch: '${{ github.event.inputs.branch }}'
game: '${{ github.event.inputs.game }}'
project-group: '${{ github.event.inputs.project-group }}'
solution-name: '${{ github.event.inputs.solution-name }}'
build-on-linux: "${{ github.event.inputs.build-on-linux == 'true' }}"

195
.github/workflows/mapbase_build-base.yml vendored Normal file
View File

@ -0,0 +1,195 @@
#
# MAPBASE SOURCE 2013 CI
#
# This workflow script automatically builds the Source SDK 2013 codebase on Windows and Linux using GitHub Actions.
#
# This is useful in a number of ways:
#
# 1. It ensures pull requests compile correctly on multiple platforms and provides binaries that can be used to test them.
# 2. It can be used to compile code for releases without having to pull and prepare a local development environment.
# 3. It opens potential for scripts that can employ more principles of CI/CD. (e.g. automatically publishing a release)
#
# This is based on a workflow originally created by z33ky.
name: Build Projects
on:
workflow_call:
inputs:
configuration:
description: 'Which configuration to build with'
default: 'Release'
required: true
type: string
branch:
description: 'Which Source 2013 engine branch to compile for'
default: 'sp'
required: true
type: string
game:
description: 'The name of the game to build (if relevant)'
default: 'episodic'
required: false
type: string
project-group:
description: 'Which group of projects to compile'
required: true
type: string
solution-name:
description: 'The name of the solution/makefile'
required: true
type: string
build-on-linux:
description: 'Build on Ubuntu/Linux?'
default: true
required: false
type: boolean
jobs:
build_windows:
name: Windows (VS2022)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: compnerd/gha-setup-vsdevenv@v6
- name: Enable VS2022
working-directory: '${{inputs.branch}}/src/vpc_scripts'
shell: bash
run: sed -i 's/^\($Conditional[ ]\+VS2022[ ]\+\).*/\1"1"/' newer_vs_toolsets.vpc
- name: Pick game
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
working-directory: '${{inputs.branch}}/src'
shell: bash
run: sed -i 's/\/hl2 \/episodic/\/${{inputs.game}}/' create${{inputs.project-group}}projects.bat
- name: Create project files
working-directory: '${{inputs.branch}}/src'
shell: cmd
# https://github.com/ValveSoftware/source-sdk-2013/issues/72
run: |
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" /v DefaultProjectExtension /t REG_SZ /d vcproj /f
create${{inputs.project-group}}projects.bat
# --------------------------------------------------------------------
- name: Build
#if: steps.filter.outputs.game == 'true'
working-directory: '${{inputs.branch}}/src'
shell: cmd
run: |
devenv ${{inputs.solution-name}}.sln /upgrade
msbuild -m -t:Rebuild -p:Configuration=${{inputs.configuration}};Platform=x86 ${{inputs.solution-name}}.sln
# --------------------------------------------------------------------
- name: Publish game binaries
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
uses: actions/upload-artifact@v4
with:
name: '${{inputs.project-group}}_${{inputs.game}}_win32_${{ inputs.configuration }}'
path: |
${{inputs.branch}}/game/mod_${{inputs.game}}/bin/*.dll
if-no-files-found: error
- name: Publish map tools
if: inputs.project-group == 'maptools'
uses: actions/upload-artifact@v4
with:
name: '${{inputs.project-group}}_win32_${{ inputs.configuration }}'
path: |
${{inputs.branch}}/game/bin/*.exe
${{inputs.branch}}/game/bin/*.dll
if-no-files-found: error
- name: Publish everything
if: inputs.project-group == 'all'
uses: actions/upload-artifact@v4
with:
name: 'everything_win32_${{ inputs.configuration }}'
path: |
${{inputs.branch}}/game/bin
${{inputs.branch}}/game/mod_*/bin
if-no-files-found: error
build_ubuntu:
if: inputs.build-on-linux == true && inputs.project-group != 'maptools' # No Linux map tools for now
name: Ubuntu (GCC/G++)
runs-on: ubuntu-latest
env:
config: ${{ inputs.configuration }}
steps:
- uses: actions/checkout@v3
- name: Install GCC/G++ multilib
run: |
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib
- name: Pick game
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
working-directory: '${{inputs.branch}}/src'
shell: bash
run: sed -i 's/\/hl2 \/episodic/\/${{inputs.game}}/' create${{inputs.project-group}}projects
- name: Set configuration
working-directory: '${{inputs.branch}}/src'
shell: bash
run: |
config=${{inputs.configuration}}
export CFG=${config,,}
echo "config=${CFG}" >> $GITHUB_ENV
- name: Create project files
working-directory: '${{inputs.branch}}/src'
run: ./create${{inputs.project-group}}projects
# --------------------------------------------------------------------
- name: Build
working-directory: '${{inputs.branch}}/src'
run: make CFG=${{env.config}} -f ${{inputs.solution-name}}.mak
# --------------------------------------------------------------------
- name: Publish game binaries
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
uses: actions/upload-artifact@v4
with:
name: '${{inputs.project-group}}_${{inputs.game}}_linux32_${{ inputs.configuration }}'
path: |
${{inputs.branch}}/game/mod_${{inputs.game}}/bin/*.so
!${{inputs.branch}}/game/mod_${{inputs.game}}/bin/*_srv.so
if-no-files-found: error
#- name: Publish map tools
# if: inputs.project-group == 'maptools'
# uses: actions/upload-artifact@v4
# with:
# name: '${{inputs.project-group}}_linux32_${{ inputs.configuration }}'
# path: |
# ${{inputs.branch}}/game/bin/vbsp
# ${{inputs.branch}}/game/bin/vvis
# ${{inputs.branch}}/game/bin/vvis_dll.so
# ${{inputs.branch}}/game/bin/vrad
# ${{inputs.branch}}/game/bin/vrad_dll.so
# if-no-files-found: error
# For now, don't publish the .dbg files even though we publish .pdb files on Windows
# (they're too big)
- name: Publish everything
if: inputs.project-group == 'all'
uses: actions/upload-artifact@v4
with:
name: 'everything_linux32_${{ inputs.configuration }}'
path: |
${{inputs.branch}}/game/bin/*.so
!${{inputs.branch}}/game/bin/*_srv.so
${{inputs.branch}}/game/mod_*/bin/*.so
!${{inputs.branch}}/game/mod_*/bin/*_srv.so
if-no-files-found: error

View File

@ -0,0 +1,31 @@
#
# MAPBASE SOURCE 2013 CI
#
# Builds all projects when a pull request to the master branch is opened.
# If you're using a fork of Mapbase, feel free to configure this to meet your repository's needs.
#
# The "mapbase_build-sp" set of workflows can build specific projects depending on what files are changed.
# They are designed around a "develop" branch, but can be configured to target "master" and replace this
# instead (or target a similar branch with a different name)
#
# See mapbase_build-base.yml for more information on how this works.
name: Build All Projects #(SP Release)
on:
pull_request:
branches:
- master
jobs:
everything:
strategy:
matrix:
configuration: [Release, Debug]
uses: ./.github/workflows/mapbase_build-base.yml
with:
configuration: ${{ matrix.configuration }}
branch: 'sp'
project-group: 'all'
solution-name: 'everything'
build-on-linux: true # Disable this if you don't want to compile for Linux

View File

@ -0,0 +1,38 @@
#
# MAPBASE SOURCE 2013 CI
#
# Builds game projects every time a pull request which modifies the game code is opened.
# If you're using a fork of Mapbase, feel free to configure this to meet your repository's needs.
#
# See mapbase_build-base.yml for more information on how this works.
name: Build Game Projects #(SP Release)
on:
pull_request:
branches:
- develop
paths:
- '.github/workflows/mapbase_build-base.yml'
- '.github/workflows/mapbase_build-sp-rel-games.yml'
- 'sp/src/vpc_scripts/**'
- 'sp/src/game/**'
- 'sp/src/mathlib/**'
- 'sp/src/responserules/runtime/**'
- 'sp/src/tier1/**'
- 'sp/src/vgui2/vgui_controls/**'
- 'sp/src/vscript/**'
jobs:
games:
strategy:
matrix:
configuration: [Release, Debug]
uses: ./.github/workflows/mapbase_build-base.yml
with:
configuration: ${{ matrix.configuration }}
branch: 'sp'
game: 'episodic' # Change this if your mod is not using HL2/Episodic game projects
project-group: 'game'
solution-name: 'games'
build-on-linux: true # Disable this if you don't want to compile for Linux

View File

@ -0,0 +1,38 @@
#
# MAPBASE SOURCE 2013 CI
#
# Builds map tool projects every time a pull request which modifies the map tool code is opened.
# If you're using a fork of Mapbase, feel free to configure this to meet your repository's needs.
#
# See mapbase_build-base.yml for more information on how this works.
name: Build Map Tool Projects #(SP Release)
on:
pull_request:
branches:
- develop
paths:
- '.github/workflows/mapbase_build-sp-rel-maptools.yml'
- 'sp/src/vpc_scripts/**'
- 'sp/src/utils/vbsp/**'
- 'sp/src/utils/vvis/**'
- 'sp/src/utils/vvis_launcher/**'
- 'sp/src/utils/vrad/**'
- 'sp/src/utils/vrad_launcher/**'
- 'sp/src/mathlib/**'
- 'sp/src/tier1/**'
- 'sp/src/vgui2/vgui_controls/**'
- 'sp/src/vscript/**'
jobs:
maptools:
strategy:
matrix:
configuration: [Release, Debug]
uses: ./.github/workflows/mapbase_build-base.yml
with:
configuration: ${{ matrix.configuration }}
branch: 'sp'
project-group: 'maptools'
solution-name: 'maptools'

View File

@ -0,0 +1,33 @@
#
# MAPBASE SOURCE 2013 CI
#
# Builds shader projects every time a pull request which modifies the shader code is opened.
# If you're using a fork of Mapbase, feel free to configure this to meet your repository's needs.
#
# See mapbase_build-base.yml for more information on how this works.
name: Build Shader Projects #(SP Release)
on:
pull_request:
branches:
- develop
paths:
- '.github/workflows/mapbase_build-sp-rel-shaders.yml'
- 'sp/src/vpc_scripts/**'
- 'sp/src/materialsystem/**'
- 'sp/src/mathlib/**'
jobs:
shaders:
strategy:
matrix:
configuration: [Release, Debug]
uses: ./.github/workflows/mapbase_build-base.yml
with:
configuration: ${{ matrix.configuration }}
branch: 'sp'
game: 'episodic' # Change this if your mod is not using HL2/Episodic game projects
project-group: 'shaders'
solution-name: 'shaders'
build-on-linux: true # Disable this if you don't want to compile for Linux

23
.github/workflows/mapbase_pr.yml vendored Normal file
View File

@ -0,0 +1,23 @@
#
# MAPBASE REPO AUTOMATION
#
# Automatically labels pull requests according to changed file paths.
#
# https://github.com/actions/labeler
name: Pull Request Automation
on: [pull_request] # pull_request_target
jobs:
label:
if: github.repository_owner == 'mapbase-source' # ${{ vars.MAPBASE_LABELS == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

137
README
View File

@ -1,10 +1,10 @@
//===================================================================================================================================================
//=========================================================================================================================
Mapbase - Source 2013
Mapbase v7.3 - Source 2013
https://github.com/mapbase-source/source-sdk-2013
https://www.moddb.com/mods/mapbase
//===================================================================================================================================================
//=========================================================================================================================
This repository contains code from Mapbase, a modification of the Source 2013 SDK which serves as a combined package
of general-purpose improvements, fixes, and utility features for mods.
@ -20,15 +20,19 @@ Mapbase's main content in this repository may include:
- View rendering changes for drawing 3D skyboxes and RT-based entities
- Countless other fixes and improvements
//===================================================================================================================================================
For more information, view this page:
https://github.com/mapbase-source/source-sdk-2013/wiki/Introduction-to-Mapbase
Mapbase is an open-source project and its contents can be distributed and used at the discretion of its users. However, this project represents many parts of
the Source modding community packaged into a whole, so credit is taken very seriously.
//=========================================================================================================================
Mapbase is an open-source project and its contents can be distributed and used at the discretion of its users. However, this project contains content from
a vast number of different sources which have their own licensing or attribution requirements. We try to handle most of that ourselves, but users who plan on
distributing Mapbase content are expected to comply with certain rules.
Up-to-date information about Mapbase content usage and credit are addressed in this article on Mapbase's wiki:
https://github.com/mapbase-source/source-sdk-2013/wiki/Using-Mapbase-Content
//===================================================================================================================================================
//=========================================================================================================================
>>>>>>>> EXTERNAL CONTENT USED IN MAPBASE <<<<<<<<
@ -37,27 +41,35 @@ and repositories (especially ones which are specifically published as free sourc
or complicated code changes accessible and easy to use for level designers and other kinds of Source modders who would otherwise have no idea how to implement them.
*** DISCLAIMER: Mapbase has a strict no-leak-content policy and only allows content created directly by contributors or content originating from open-source repositories.
If you believe any content in Mapbase originates from any leak or unauthorized source (from Valve or otherwise), please contact Blixibon immediately.
If you believe any content in Mapbase originates from any leak or unauthorized source (Valve or otherwise), please contact Blixibon immediately.
Mapbase is intended to be usable by everyone, including licensed Source projects and Steam mods. ***
The Alien Swarm SDK was used to backport features and code from newer branches of Source into a Source 2013/Half-Life 2 environment.
Mapbase also implements some of Tony Sergi's code changes from the Source 2007 SDK codebase. Both SDKs are publicly distributed by Valve and are available on Steam.
Mapbase uses content from the following non-Source SDK 2013 Valve games or SDKs:
Some of the features backported from the Alien Swarm SDK (e.g. game instructor, particle rain) require assets from later versions of Source in order to work properly.
The required assets have been backported from Alien Swarm and Left 4 Dead for the release build. They are not available in the code repository.
-- Alien Swarm SDK (Used to backport features and code from newer branches of Source into a Source 2013/Half-Life 2 environment)
-- Source SDK 2007 Code (Used to implement some of Tony Sergi's code changes)
Here's a list of Mapbase's other known external code sources:
-- Alien Swarm (Used to port assets from the aforementioned SDK code features, e.g. game instructor icons)
-- Left 4 Dead (Used to port certain animations as well as assets from the aforementioned SDK code features, e.g. particle rain)
-- Half-Life: Source (Used to port friction tool textures)
Valve allows assets from these titles to be distributed for modding purposes. Note that ported assets are only used in the release build, not the code repository.
Mapbase may also contain new third-party software distributed under specific licensing. Please see the bottom of thirdpartylegalnotices.txt for more information.
Here's a list of Mapbase's other external code sources:
- https://github.com/95Navigator/insolence-2013 (Initial custom shader code and projected texture improvements; also used to implement ASW SDK particle precipitation code)
- https://github.com/Biohazard90/g-string_2013 (Custom shadow filters, included indirectly via Insolence repo)
- https://github.com/KyleGospo/City-17-Episode-One-Source (Brush phong and projected texture changes, included indirectly via Insolence repo)
-- https://github.com/Biohazard90/g-string_2013 (Custom shadow filters, included indirectly via Insolence repo)
-- https://github.com/KyleGospo/City-17-Episode-One-Source (Brush phong and projected texture changes, included indirectly via Insolence repo)
- https://github.com/DownFall-Team/DownFall (Multiple skybox code and fix for ent_fire delay not using floats; Also used as a guide to port certain Alien Swarm SDK changes to Source 2013,
including radial fog, rope code, and treesway)
- https://github.com/momentum-mod/game (Used as a guide to port postprocess_controller and env_dof_controller to Source 2013)
- https://github.com/momentum-mod/game (Used as a guide to port postprocess_controller and env_dof_controller to Source 2013 from the Alien Swarm SDK)
- https://github.com/DeathByNukes/source-sdk-2013 (VBSP manifest fixes)
- https://github.com/entropy-zero/source-sdk-2013 (skill_changed game event)
- https://github.com/Nbc66/source-sdk-2013-ce/tree/v142 (Base for VS2019 toolset support)
//---------------------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
Valve Developer Community (VDC) sources:
@ -85,28 +97,94 @@ interchangeable arms; this may change in the future)
- https://developer.valvesoftware.com/wiki/Func_clip_vphysics ("Start Disabled" keyvalue fix)
- https://developer.valvesoftware.com/wiki/Importing_CSS_Weapons_Into_HL2 (CS:S viewmodel chirality)
//---------------------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
Direct contributions:
- https://github.com/mapbase-source/source-sdk-2013/pull/3 ("playvideo" command playback fix from Avanate)
- https://github.com/mapbase-source/source-sdk-2013/pull/5 (Custom VScript implementation by ReDucTor; was placed into feature branch before being merged in a subsequent PR)
- https://github.com/mapbase-source/source-sdk-2013/pull/3 ("playvideo" command playback fix from Avantate)
- https://github.com/mapbase-source/source-sdk-2013/pull/21 (Various GCC/Linux fixes from z33ky)
- https://github.com/mapbase-source/source-sdk-2013/pull/60 (Adjustment by RoyaleNoir to one of Saul's VDC changes)
- https://github.com/mapbase-source/source-sdk-2013/pull/84 (CS:S viewmodel chirality from 1upD)
- https://github.com/mapbase-source/source-sdk-2013/pull/116 (vgui_movie_display mute keyvalue from Alivebyte/rzkid)
- https://github.com/mapbase-source/source-sdk-2013/pull/140 (logic_substring entity and icon created by moofemp)
- https://github.com/mapbase-source/source-sdk-2013/pull/143 (Propper features for VBSP from Matty-64)
- https://github.com/mapbase-source/source-sdk-2013/pull/174 (Fix for multiply defined symbols in later toolsets from und)
- https://github.com/mapbase-source/source-sdk-2013/issues/201 (env_projectedtexture shadow filter keyvalue from celisej567)
- https://github.com/mapbase-source/source-sdk-2013/pull/193 (RTB:R info_particle_system_coordinate by arbabf and Iridium77)
- https://github.com/mapbase-source/source-sdk-2013/pull/193 (Infinite prop_interactable cooldown by arbabf)
- https://github.com/mapbase-source/source-sdk-2013/pull/229 (Extended point_bugbait functionality by arbabf)
- https://github.com/mapbase-source/source-sdk-2013/pull/236 (Toggleable prop sprinting by Crimson-X1)
- https://github.com/mapbase-source/source-sdk-2013/pull/237 (Commander goal trace fix by Agrimar)
- https://github.com/mapbase-source/source-sdk-2013/pull/245 (ViewPunch random fix by Mr0maks)
- https://github.com/mapbase-source/source-sdk-2013/pull/248 (soundlevel_t conversation warning fix by Mechami)
- https://github.com/mapbase-source/source-sdk-2013/pull/266 ("OnPhysGunPull" output in CPhysicsProp by rlenhub)
- https://github.com/mapbase-source/source-sdk-2013/pull/292 (env_headcrabcanister random spawn type by arbabf)
- https://github.com/mapbase-source/source-sdk-2013/pull/294 (SDK_LightmappedGeneric editor blend swap fix by azzyr)
- https://github.com/mapbase-source/source-sdk-2013/pull/308 (BlurFilterY fix by Wikot235)
- https://github.com/mapbase-source/source-sdk-2013/pull/312 (Zombie improvements by Wikot235)
- https://github.com/mapbase-source/source-sdk-2013/pull/315 (env_flare crash fix by Wikot235)
- https://github.com/mapbase-source/source-sdk-2013/pull/324 (server-only info/func_null by SirYodaJedi)
- https://github.com/mapbase-source/source-sdk-2013/pull/333 (Cvar to transition levels while in MOVETYPE_NOCLIP by Wikot235)
- https://github.com/mapbase-source/source-sdk-2013/pull/342 (NaN particle cull radius fix by celisej567)
- https://github.com/mapbase-source/mapbase-game-src/pull/1 (Advanced video options duplicate field name fix by arbabf; This is asset-based and not reflected in the code)
- https://github.com/mapbase-source/mapbase-game-src/pull/2 (gameinfo.txt typo fix by CarePackage17; This is asset-based and not reflected in the code)
- https://github.com/mapbase-source/mapbase-game-src/pull/3 (HudMessage cutoff fix by arbabf; This is asset-based and not reflected in the code)
- Demo autorecord code provided by Klems
- cc_emit crash fix provided by 1upD
- Custom HL2 ammo crate models created by Rara (Textures created by Blixibon; This is asset-based and, aside from the SLAM crate, not reflected in the code)
- Custom HL2 ammo crate models created by Rykah (Textures created by Blixibon; This is asset-based and, aside from the SLAM crate, not reflected in the code)
- Combine lock hardware on door01_left.mdl created by Kralich (This is asset-based and not reflected in the code)
- npc_vehicledriver fixes provided by CrAzY
- npc_combine cover behavior patches provided by iohnnyboy
- logic_playmovie icon created by URAKOLOUY5 (This is asset-based and not reflected in the code)
- Dropship APC save/load fix provided by Cvoxulary
== Contributions from samisalreadytaken:
=-- https://github.com/mapbase-source/source-sdk-2013/pull/47 (VScript utility/consistency changes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/59 (New VScript functions and singletons based on API documentation in later Source/Source 2 games)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/80 (More VScript changes, including support for extremely flexible client/server messaging)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/105 (VScript fixes and optimizations, Vector class extensions, custom convars/commands)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/114 (VScript fixes and extensions)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/122 (Minor VScript-related adjustments)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/148 (Minor fixup)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/167 (Security fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/168 (Squirrel update)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/169 (VScript VGUI)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/171 (VScript documentation sorting)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/173 (VScript fixes and optimizations)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/192 (VScript hook manager and fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/206 (Fix CScriptNetMsgHelper::WriteEntity())
=-- https://github.com/mapbase-source/source-sdk-2013/pull/213 (VScript HUD visibility control, optimizations for 3D skybox angles/fake worldportals)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/229 (VScript VGUI HUD viewport parenting, game_text and vgui_text_display VScript font fallback)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/260 (CScriptNetPropManager rewrite)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/261 (Misc VScript additions)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/279 (weapon_custom_scripted fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/332 (Fix OOB access)
//---------------------------------------------------------------------------------------------------------------------------------------------------
== Contributions from z33ky:
=-- https://github.com/mapbase-source/source-sdk-2013/pull/21 (Various GCC/Linux compilation fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/95 (Additional GCC/Linux compilation fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/117 (Additional GCC/Linux compilation fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/124 (Memory error fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/130 (Memory error fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/131 (env_projectedtexture target shadows fix)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/132 (Console error fix)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/152 (Additional GCC/Linux compilation fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/159 (Additional GCC/Linux compilation fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/162 (VS2019 exception specification fix)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/170 (HL2 non-Episodic build fix)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/322 (Small Mapbase fixes)
== Contributions from Petercov:
=-- https://github.com/mapbase-source/source-sdk-2013/pull/182 (NPCs load dynamic interactions from all animation MDLs)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/184 (Projected texture horizontal FOV shadow fix)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/185 (Fix enemyfinders becoming visible when they wake)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/186 (Fix for brightly glowing teeth)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/183 (Enhanced custom weapons support)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/230 (Caption fixes)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/231 (Sentence source bug fix)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/264 (Outputs for vgui_screen)
//-------------------------------------------------------------------------------------------------------------------------
Other sources:
@ -117,22 +195,31 @@ Other sources:
-- https://github.com/ValveSoftware/source-sdk-2013/pull/401 (func_rot_button "Starts locked" flag fix)
-- https://github.com/ValveSoftware/source-sdk-2013/pull/391 (VBSP func_detail smoothing group fix)
-- https://github.com/ValveSoftware/source-sdk-2013/pull/362 (npc_manhack npc_maker fix; Adjusted for formatting and save/restore in Mapbase)
-- https://github.com/Petercov/Source-PlusPlus/commit/ecdf50c48cd31dec4dbdb7fea2d0780e7f0dd8ec (used as a guide for porting the Alien Swarm SDK response system)
- https://github.com/momentum-mod/game/blob/1d066180b3bf74830c51e6914d46c40b0bea1fc2/mp/src/game/server/player.cpp#L6543 (spec_goto fix)
- Poison zombie barnacle crash fix implemented based on a snippet from HL2: Plus posted by Agent Agrimar on Discord (Mapbase makes the barnacle recognize it as poison just like poison headcrabs)
- https://gamebanana.com/skins/172192 (Airboat handling fix; This is asset-based and not reflected in the code)
- Vortigaunt LOS fix originally created by dky.tehkingd.u for HL2:CE
- https://combineoverwiki.net/wiki/File:Combine_main_symbol.svg ("icon_combine" instructor icon in "materials/vgui/hud/gameinstructor_hl2_1"; This is asset-based and not reflected in the code)
//---------------------------------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
If there is anything missing from this list, please contact Blixibon.
//===================================================================================================================================================
//=========================================================================================================================
Aside from the content list above, Mapbase has more descriptive and up-to-date credits on this wiki article:
https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Credits
//===================================================================================================================================================
Other relevant articles:
* https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Disclaimers
* https://github.com/mapbase-source/source-sdk-2013/wiki/Frequently-Asked-Questions-(FAQ)
//-------------------------------------------------------------------------------------------------------------------------
In memory of Holly Liberatore (moofemp)
//=========================================================================================================================
Please see the Source SDK 2013 license below:

View File

@ -146,6 +146,8 @@ CParticleEffectBinding::CParticleEffectBinding()
m_LastMin = m_Min;
m_LastMax = m_Max;
m_flParticleCullRadius = 0.0f;
SetParticleCullRadius( 0.0f );
m_nActiveParticles = 0;

View File

@ -22,10 +22,10 @@ void CPointEntity::Spawn( void )
}
class CNullEntity : public CBaseEntity
class CNullEntity : public CServerOnlyEntity
{
public:
DECLARE_CLASS( CNullEntity, CBaseEntity );
DECLARE_CLASS( CNullEntity, CServerOnlyEntity );
void Spawn( void );
};

View File

@ -208,7 +208,7 @@ void CWeaponAR2::DelayedAttack( void )
// pOwner->SnapEyeAngles( angles );
pOwner->ViewPunch( QAngle( SharedRandomInt( "ar2pax", -8, -12 ), SharedRandomInt( "ar2pay", 1, 2 ), 0 ) );
pOwner->ViewPunch( QAngle( SharedRandomInt( "ar2pax", -12, -8 ), SharedRandomInt( "ar2pay", 1, 2 ), 0 ) );
// Decrease ammo
pOwner->RemoveAmmo( 1, m_iSecondaryAmmoType );

5
sp/src/createmaptoolsprojects Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pushd `dirname $0`
devtools/bin/vpc /hl2 /episodic +maptools /mksln maptools
popd

View File

@ -0,0 +1 @@
devtools\bin\vpc.exe +maptools /mksln maptools.sln

5
sp/src/createshadersprojects Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pushd `dirname $0`
devtools/bin/vpc /hl2 /episodic +shaders /mksln shaders
popd

View File

@ -0,0 +1 @@
devtools\bin\vpc.exe /hl2 /episodic +shaders /mksln shaders.sln

View File

@ -6,10 +6,11 @@ MAKEFILE_LINK:=$(THISFILE).link
-include $(MAKEFILE_LINK)
$(MAKEFILE_LINK): $(shell which $(CC)) $(THISFILE)
if [ "$(shell printf "$(shell $(CC) -dumpversion)\n8" | sort -Vr | head -1)" = 8 ]; then \
$(COMPILE.cpp) -o gcc9+support.o gcc9+support.c ;\
# depend on CXX so the correct makefile can be selected when the system is updated
$(MAKEFILE_LINK): $(shell which $(CXX)) $(THISFILE) $(SRCROOT)/devtools/gcc9+support.cpp
@ if [ "$(shell printf "$(shell $(CXX) -dumpversion)\n8" | sort -Vr | head -1)" = 8 ]; then \
ln -sf $(MAKEFILE_BASE).default $@ ;\
else \
$(COMPILE.cpp) -m32 -o $(SRCROOT)/devtools/gcc9+support.o $(SRCROOT)/devtools/gcc9+support.cpp &&\
ln -sf $(MAKEFILE_BASE).gcc8 $@ ;\
fi

View File

@ -92,6 +92,7 @@ private:
float m_flLinearAtten;
float m_flQuadraticAtten;
float m_flShadowAtten;
float m_flShadowFilter;
bool m_bAlwaysDraw;
//bool m_bProjectedTextureVersion;

View File

@ -259,6 +259,9 @@ LINK_ENTITY_TO_CLASS( client_ragdoll, C_ClientRagdoll );
BEGIN_DATADESC( C_ClientRagdoll )
DEFINE_FIELD( m_bFadeOut, FIELD_BOOLEAN ),
DEFINE_FIELD( m_bImportant, FIELD_BOOLEAN ),
#ifdef MAPBASE
DEFINE_FIELD( m_flForcedRetireTime, FIELD_FLOAT ),
#endif
DEFINE_FIELD( m_iCurrentFriction, FIELD_INTEGER ),
DEFINE_FIELD( m_iMinFriction, FIELD_INTEGER ),
DEFINE_FIELD( m_iMaxFriction, FIELD_INTEGER ),
@ -293,6 +296,8 @@ BEGIN_ENT_SCRIPTDESC( C_ClientRagdoll, C_BaseAnimating, "Client-side ragdolls" )
END_SCRIPTDESC();
ScriptHook_t C_BaseAnimating::g_Hook_OnClientRagdoll;
ScriptHook_t C_BaseAnimating::g_Hook_FireEvent;
//ScriptHook_t C_BaseAnimating::g_Hook_BuildTransformations;
#endif
BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-side" )
@ -309,6 +314,14 @@ BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-si
DEFINE_SCRIPTFUNC( LookupBone, "Get the named bone id" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoneTransform, "GetBoneTransform", "Get the transform for the specified bone" )
DEFINE_SCRIPTFUNC_NAMED( ScriptSetBoneTransform, "SetBoneTransform", "Set the transform for the specified bone" )
DEFINE_SCRIPTFUNC_NAMED( ScriptAttachEntityToBone, "AttachEntityToBone", "Attaches this entity to the specified target and bone. Also allows for optional local position offset" )
DEFINE_SCRIPTFUNC_NAMED( ScriptRemoveBoneAttachment, "RemoveBoneAttachment", "Removes the specified bone attachment" )
//DEFINE_SCRIPTFUNC( RemoveBoneAttachments, "Removes all bone attachments" )
DEFINE_SCRIPTFUNC( DestroyBoneAttachments, "Destroys all bone attachments" )
DEFINE_SCRIPTFUNC( GetNumBoneAttachments, "Gets the number of bone attachments" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoneAttachment, "GetBoneAttachment", "Gets the specified bone attachment" )
DEFINE_SCRIPTFUNC( SetBodygroup, "Sets a bodygroup")
DEFINE_SCRIPTFUNC( GetBodygroup, "Gets a bodygroup" )
@ -319,7 +332,7 @@ BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-si
DEFINE_SCRIPTFUNC( GetSequence, "Gets the current sequence" )
DEFINE_SCRIPTFUNC( SetSequence, "Sets the current sequence" )
DEFINE_SCRIPTFUNC( SequenceLoops, "Loops the current sequence" )
DEFINE_SCRIPTFUNC( SequenceLoops, "Does the current sequence loop?" )
DEFINE_SCRIPTFUNC( LookupSequence, "Gets the index of the specified sequence name" )
DEFINE_SCRIPTFUNC( LookupActivity, "Gets the ID of the specified activity name" )
DEFINE_SCRIPTFUNC( GetSequenceName, "Gets the name of the specified sequence index" )
@ -346,6 +359,16 @@ BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-si
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_OnClientRagdoll, "OnClientRagdoll", FIELD_VOID, "Called when this entity turns into a client-side ragdoll." )
DEFINE_SCRIPTHOOK_PARAM( "ragdoll", FIELD_HSCRIPT )
END_SCRIPTHOOK()
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_FireEvent, "FireEvent", FIELD_BOOLEAN, "Called when handling animation events. Return false to cancel base handling." )
DEFINE_SCRIPTHOOK_PARAM( "origin", FIELD_VECTOR )
DEFINE_SCRIPTHOOK_PARAM( "angles", FIELD_VECTOR )
DEFINE_SCRIPTHOOK_PARAM( "event", FIELD_INTEGER )
DEFINE_SCRIPTHOOK_PARAM( "options", FIELD_CSTRING )
END_SCRIPTHOOK()
//BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_BuildTransformations, "BuildTransformations", FIELD_VOID, "Called when building bone transformations. Allows VScript to read/write any bone with Get/SetBoneTransform." )
//END_SCRIPTHOOK()
#endif
END_SCRIPTDESC();
@ -357,6 +380,9 @@ C_ClientRagdoll::C_ClientRagdoll( bool bRestoring )
m_bFadeOut = false;
m_bFadingOut = false;
m_bImportant = false;
#ifdef MAPBASE
m_flForcedRetireTime = 0.0f;
#endif
m_bNoModelParticles = false;
SetClassname("client_ragdoll");
@ -437,7 +463,11 @@ void C_ClientRagdoll::OnRestore( void )
if ( m_bFadeOut == true )
{
#ifdef MAPBASE
s_RagdollLRU.MoveToTopOfLRU( this, m_bImportant, m_flForcedRetireTime );
#else
s_RagdollLRU.MoveToTopOfLRU( this, m_bImportant );
#endif
}
NoteRagdollCreationTick( this );
@ -764,6 +794,10 @@ C_BaseAnimating::C_BaseAnimating() :
m_nPrevSequence = -1;
m_nRestoreSequence = -1;
m_pRagdoll = NULL;
m_pClientsideRagdoll = NULL;
#ifdef MAPBASE
m_pServerRagdoll = NULL;
#endif
m_builtRagdoll = false;
m_hitboxBoneCacheHandle = 0;
int i;
@ -1530,10 +1564,43 @@ HSCRIPT C_BaseAnimating::ScriptGetAttachmentMatrix( int iAttachment )
void C_BaseAnimating::ScriptGetBoneTransform( int iBone, HSCRIPT hTransform )
{
if (hTransform == NULL)
matrix3x4_t *matTransform = HScriptToClass<matrix3x4_t>( hTransform );
if (matTransform == NULL)
return;
GetBoneTransform( iBone, *HScriptToClass<matrix3x4_t>( hTransform ) );
GetBoneTransform( iBone, *matTransform );
}
void C_BaseAnimating::ScriptSetBoneTransform( int iBone, HSCRIPT hTransform )
{
matrix3x4_t *matTransform = HScriptToClass<matrix3x4_t>( hTransform );
if (matTransform == NULL)
return;
MatrixCopy( *matTransform, GetBoneForWrite( iBone ) );
}
void C_BaseAnimating::ScriptAttachEntityToBone( HSCRIPT attachTarget, int boneIndexAttached, const Vector &bonePosition, const QAngle &boneAngles )
{
C_BaseEntity *pTarget = ToEnt( attachTarget );
if (pTarget == NULL)
return;
AttachEntityToBone( pTarget->GetBaseAnimating(), boneIndexAttached, bonePosition, boneAngles );
}
void C_BaseAnimating::ScriptRemoveBoneAttachment( HSCRIPT boneAttachment )
{
C_BaseEntity *pTarget = ToEnt( boneAttachment );
if (pTarget == NULL)
return;
RemoveBoneAttachment( pTarget->GetBaseAnimating() );
}
HSCRIPT C_BaseAnimating::ScriptGetBoneAttachment( int i )
{
return ToHScript( GetBoneAttachment( i ) );
}
HSCRIPT C_BaseAnimating::ScriptBecomeRagdollOnClient()
@ -1711,7 +1778,23 @@ void C_BaseAnimating::BuildTransformations( CStudioHdr *hdr, Vector *pos, Quater
}
}
#ifdef MAPBASE_VSCRIPT
//if (m_ScriptScope.IsInitialized() && g_Hook_BuildTransformations.CanRunInScope(m_ScriptScope))
//{
// int oldWritableBones = m_BoneAccessor.GetWritableBones();
// int oldReadableBones = m_BoneAccessor.GetReadableBones();
// m_BoneAccessor.SetWritableBones( BONE_USED_BY_ANYTHING );
// m_BoneAccessor.SetReadableBones( BONE_USED_BY_ANYTHING );
//
// // No parameters
// //ScriptVariant_t args[] = {};
// //ScriptVariant_t returnValue;
// g_Hook_BuildTransformations.Call( m_ScriptScope, NULL, NULL /*&returnValue, args*/ );
//
// m_BoneAccessor.SetWritableBones( oldWritableBones );
// m_BoneAccessor.SetReadableBones( oldReadableBones );
//}
#endif
}
//-----------------------------------------------------------------------------
@ -1917,6 +2000,10 @@ CollideType_t C_BaseAnimating::GetCollideType( void )
return BaseClass::GetCollideType();
}
#ifdef MAPBASE
ConVar ai_death_pose_enabled( "ai_death_pose_enabled", "1", FCVAR_NONE, "Toggles the death pose fix code, which cancels sequence transitions while a NPC is ragdolling." );
#endif
//-----------------------------------------------------------------------------
// Purpose: if the active sequence changes, keep track of the previous ones and decay them based on their decay rate
//-----------------------------------------------------------------------------
@ -1933,6 +2020,14 @@ void C_BaseAnimating::MaintainSequenceTransitions( IBoneSetup &boneSetup, float
return;
}
#ifdef MAPBASE
if ( IsAboutToRagdoll() && ai_death_pose_enabled.GetBool() )
{
m_nPrevNewSequenceParity = m_nNewSequenceParity;
return;
}
#endif
m_SequenceTransitioner.CheckForSequenceChange(
boneSetup.GetStudioHdr(),
GetSequence(),
@ -2712,14 +2807,29 @@ void C_BaseAnimating::CalculateIKLocks( float currentTime )
// debugoverlay->AddBoxOverlay( origin, Vector( -1, -1, -1 ), Vector( 1, 1, 1 ), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 0 );
float d = (pTarget->est.pos - origin).Length();
Vector vecDelta = (origin - pTarget->est.pos);
float d = vecDelta.Length();
if ( d >= flDist)
continue;
flDist = d;
#ifdef MAPBASE
// For blending purposes, IK attachments should obey weight
if ( pTarget->est.flWeight < 1.0f )
{
Quaternion qTarget;
AngleQuaternion( angles, qTarget );
QuaternionSlerp( pTarget->est.q, qTarget, pTarget->est.flWeight, pTarget->est.q );
pTarget->SetPos( pTarget->est.pos + (vecDelta * pTarget->est.flWeight) );
}
else
#endif
{
pTarget->SetPos( origin );
pTarget->SetAngles( angles );
}
// debugoverlay->AddBoxOverlay( pTarget->est.pos, Vector( -pTarget->est.radius, -pTarget->est.radius, -pTarget->est.radius ), Vector( pTarget->est.radius, pTarget->est.radius, pTarget->est.radius), QAngle( 0, 0, 0 ), 0, 255, 0, 0, 0 );
}
@ -3652,6 +3762,10 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
gpGlobals->curtime );
}
#ifdef MAPBASE_VSCRIPT
if (ScriptHookFireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() ) == false)
continue;
#endif
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
}
@ -3684,6 +3798,11 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
gpGlobals->curtime );
}
#ifdef MAPBASE_VSCRIPT
if (ScriptHookFireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() ) == false)
continue;
#endif
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
}
}
@ -3691,6 +3810,26 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
m_flPrevEventCycle = flEventCycle;
}
#ifdef MAPBASE_VSCRIPT
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool C_BaseAnimating::ScriptHookFireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
{
if (m_ScriptScope.IsInitialized() && g_Hook_FireEvent.CanRunInScope(m_ScriptScope))
{
// origin, angles, event, options
ScriptVariant_t args[] = { origin, angles, event, options };
ScriptVariant_t returnValue = true;
g_Hook_FireEvent.Call( m_ScriptScope, &returnValue, args );
return returnValue.m_bool;
}
return true;
}
#endif
//-----------------------------------------------------------------------------
// Purpose: Parses a muzzle effect event and sends it out for drawing
// Input : *options - event parameters in text format
@ -3903,6 +4042,92 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
}
break;
#ifdef MAPBASE // From Alien Swarm SDK
case AE_CL_STOP_PARTICLE_EFFECT:
{
char token[256];
char szParticleEffect[256];
// Get the particle effect name
const char *p = options;
p = nexttoken(token, p, ' ', sizeof(token));
if ( token )
{
Q_strncpy( szParticleEffect, token, sizeof(szParticleEffect) );
}
// Get the attachment point index
p = nexttoken(token, p, ' ', sizeof(token));
bool bStopInstantly = ( token && !Q_stricmp( token, "instantly" ) );
ParticleProp()->StopParticlesNamed( szParticleEffect, bStopInstantly );
}
break;
case AE_CL_ADD_PARTICLE_EFFECT_CP:
{
int iControlPoint = 1;
int iAttachment = -1;
int iAttachType = PATTACH_ABSORIGIN_FOLLOW;
int iEffectIndex = -1;
char token[256];
char szParticleEffect[256];
// Get the particle effect name
const char *p = options;
p = nexttoken(token, p, ' ', sizeof(token));
if ( token )
{
Q_strncpy( szParticleEffect, token, sizeof(szParticleEffect) );
}
// Get the control point number
p = nexttoken(token, p, ' ', sizeof(token));
if ( token )
{
iControlPoint = atoi( token );
}
// Get the attachment type
p = nexttoken(token, p, ' ', sizeof(token));
if ( token )
{
iAttachType = GetAttachTypeFromString( token );
if ( iAttachType == -1 )
{
Warning("Invalid attach type specified for particle effect anim event. Trying to spawn effect '%s' with attach type of '%s'\n", szParticleEffect, token );
return;
}
}
// Get the attachment point index
p = nexttoken(token, p, ' ', sizeof(token));
if ( token )
{
iAttachment = atoi(token);
// See if we can find any attachment points matching the name
if ( token[0] != '0' && iAttachment == 0 )
{
iAttachment = LookupAttachment( token );
if ( iAttachment == -1 )
{
Warning("Failed to find attachment point specified for particle effect anim event. Trying to spawn effect '%s' on attachment named '%s'\n", szParticleEffect, token );
return;
}
}
}
iEffectIndex = ParticleProp()->FindEffect( szParticleEffect );
if ( iEffectIndex == -1 )
{
Warning("Failed to find specified particle effect. Trying to add CP to '%s' on attachment named '%s'\n", szParticleEffect, token );
return;
}
ParticleProp()->AddControlPoint( iEffectIndex, iControlPoint, this, (ParticleAttachment_t)iAttachType, iAttachment );
}
break;
#endif
case AE_CL_PLAYSOUND:
{
CLocalPlayerFilter filter;
@ -4152,6 +4377,22 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
}
break;
#ifdef MAPBASE
case AE_VSCRIPT_RUN:
{
if (!RunScript( options ))
Warning( "%s failed to run AE_VSCRIPT_RUN on client with \"%s\"\n", GetDebugName(), options );
}
break;
case AE_VSCRIPT_RUN_FILE:
{
if (!RunScriptFile( options ))
Warning( "%s failed to run AE_VSCRIPT_RUN_FILE on client with \"%s\"\n", GetDebugName(), options );
}
break;
#endif
default:
break;
}
@ -4771,12 +5012,18 @@ void C_BaseAnimating::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matri
}
}
C_ClientRagdoll *C_BaseAnimating::CreateClientRagdoll( bool bRestoring )
{
//DevMsg( "Creating ragdoll at tick %d\n", gpGlobals->tickcount );
return new C_ClientRagdoll( bRestoring );
}
C_BaseAnimating *C_BaseAnimating::CreateRagdollCopy()
{
//Adrian: We now create a separate entity that becomes this entity's ragdoll.
//That way the server side version of this entity can go away.
//Plus we can hook save/restore code to these ragdolls so they don't fall on restore anymore.
C_ClientRagdoll *pRagdoll = new C_ClientRagdoll( false );
C_ClientRagdoll *pRagdoll = CreateClientRagdoll( false );
if ( pRagdoll == NULL )
return NULL;
@ -4844,26 +5091,26 @@ C_BaseAnimating *C_BaseAnimating::BecomeRagdollOnClient()
{
MoveToLastReceivedPosition( true );
GetAbsOrigin();
C_BaseAnimating *pRagdoll = CreateRagdollCopy();
m_pClientsideRagdoll = CreateRagdollCopy();
matrix3x4_t boneDelta0[MAXSTUDIOBONES];
matrix3x4_t boneDelta1[MAXSTUDIOBONES];
matrix3x4_t currentBones[MAXSTUDIOBONES];
const float boneDt = 0.1f;
GetRagdollInitBoneArrays( boneDelta0, boneDelta1, currentBones, boneDt );
pRagdoll->InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt );
m_pClientsideRagdoll->InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt );
#ifdef MAPBASE_VSCRIPT
// Hook for ragdolling
if (m_ScriptScope.IsInitialized() && g_Hook_OnClientRagdoll.CanRunInScope( m_ScriptScope ))
{
// ragdoll
ScriptVariant_t args[] = { ScriptVariant_t( pRagdoll->GetScriptInstance() ) };
ScriptVariant_t args[] = { ScriptVariant_t( m_pClientsideRagdoll->GetScriptInstance() ) };
g_Hook_OnClientRagdoll.Call( m_ScriptScope, NULL, args );
}
#endif
return pRagdoll;
return m_pClientsideRagdoll;
}
bool C_BaseAnimating::InitAsClientRagdoll( const matrix3x4_t *pDeltaBones0, const matrix3x4_t *pDeltaBones1, const matrix3x4_t *pCurrentBonePosition, float boneDt, bool bFixedConstraints )
@ -5329,6 +5576,11 @@ void C_BaseAnimating::StudioFrameAdvance()
if ( flNewCycle < 0.0f || flNewCycle >= 1.0f )
{
if (flNewCycle >= 1.0f)
{
ReachedEndOfSequence();
}
if ( IsSequenceLooping( hdr, GetSequence() ) )
{
flNewCycle -= (int)(flNewCycle);

View File

@ -38,6 +38,7 @@ class C_BaseClientShader
*/
class IRagdoll;
class C_ClientRagdoll;
class CIKContext;
class CIKState;
class ConVar;
@ -79,7 +80,7 @@ public:
QAngle m_angRotation;
Vector m_vOriginVelocity;
int m_nLastFramecount : 31;
int m_bAnglesComputed : 1;
bool m_bAnglesComputed : 1;
};
@ -164,6 +165,10 @@ public:
virtual void FireObsoleteEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
virtual const char* ModifyEventParticles( const char* token ) { return token; }
#ifdef MAPBASE_VSCRIPT
bool ScriptHookFireEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
#endif
#if defined ( SDK_DLL ) || defined ( HL2MP )
virtual void ResetEventsParity() { m_nPrevResetEventsParity = -1; } // used to force animation events to function on players so the muzzleflashes and other events occur
// so new functions don't have to be made to parse the models like CSS does in ProcessMuzzleFlashEvent
@ -297,6 +302,7 @@ public:
bool IsRagdoll() const;
bool IsAboutToRagdoll() const;
virtual C_BaseAnimating *BecomeRagdollOnClient();
virtual C_ClientRagdoll *CreateClientRagdoll( bool bRestoring = false );
C_BaseAnimating *CreateRagdollCopy();
bool InitAsClientRagdoll( const matrix3x4_t *pDeltaBones0, const matrix3x4_t *pDeltaBones1, const matrix3x4_t *pCurrentBonePosition, float boneDt, bool bFixedConstraints=false );
void IgniteRagdoll( C_BaseAnimating *pSource );
@ -350,6 +356,8 @@ public:
void ClientSideAnimationChanged();
virtual unsigned int ComputeClientSideAnimationFlags();
virtual void ReachedEndOfSequence() { return; }
virtual void ResetClientsideFrame( void ) { SetCycle( 0 ); }
void SetCycle( float flCycle );
@ -460,6 +468,11 @@ public:
HSCRIPT ScriptGetAttachmentMatrix(int iAttachment);
void ScriptGetBoneTransform( int iBone, HSCRIPT hTransform );
void ScriptSetBoneTransform( int iBone, HSCRIPT hTransform );
void ScriptAttachEntityToBone( HSCRIPT attachTarget, int boneIndexAttached, const Vector &bonePosition, const QAngle &boneAngles );
void ScriptRemoveBoneAttachment( HSCRIPT boneAttachment );
HSCRIPT ScriptGetBoneAttachment( int i );
int ScriptGetSequenceActivity( int iSequence ) { return GetSequenceActivity( iSequence ); }
float ScriptGetSequenceMoveDist( int iSequence ) { return GetSequenceMoveDist( GetModelPtr(), iSequence ); }
@ -477,6 +490,8 @@ public:
HSCRIPT ScriptBecomeRagdollOnClient();
static ScriptHook_t g_Hook_OnClientRagdoll;
static ScriptHook_t g_Hook_FireEvent;
//static ScriptHook_t g_Hook_BuildTransformations; // UNDONE: Thread access issues
float ScriptGetPoseParameter(const char* szName);
#endif
@ -516,6 +531,10 @@ private:
public:
CRagdoll *m_pRagdoll;
C_BaseAnimating *m_pClientsideRagdoll; // From Alien Swarm SDK
#ifdef MAPBASE
C_BaseAnimating *m_pServerRagdoll; // Not from Alien Swarm SDK (note that this can exist without the entity having died)
#endif
// Texture group to use
int m_nSkin;
@ -718,6 +737,10 @@ public:
bool m_bFadeOut;
bool m_bImportant;
#ifdef MAPBASE
// Required to save/restore Alien Swarm SDK ragdoll LRU forced fade
float m_flForcedRetireTime;
#endif
float m_flEffectTime;
private:

View File

@ -34,6 +34,10 @@ C_BaseCombatCharacter::C_BaseCombatCharacter()
m_pGlowEffect = NULL;
m_bGlowEnabled = false;
m_bOldGlowEnabled = false;
m_GlowColor.Init( 0.76f, 0.76f, 0.76f );
m_OldGlowColor = m_GlowColor;
m_GlowAlpha = 1.0f;
m_OldGlowAlpha = 1.0f;
#endif // GLOWS_ENABLE
}
@ -66,6 +70,8 @@ void C_BaseCombatCharacter::OnPreDataChanged( DataUpdateType_t updateType )
#ifdef GLOWS_ENABLE
m_bOldGlowEnabled = m_bGlowEnabled;
m_OldGlowColor = m_GlowColor;
m_OldGlowAlpha = m_GlowAlpha;
#endif // GLOWS_ENABLE
}
@ -77,7 +83,7 @@ void C_BaseCombatCharacter::OnDataChanged( DataUpdateType_t updateType )
BaseClass::OnDataChanged( updateType );
#ifdef GLOWS_ENABLE
if ( m_bOldGlowEnabled != m_bGlowEnabled )
if ( m_bOldGlowEnabled != m_bGlowEnabled || m_OldGlowColor != m_GlowColor || m_OldGlowAlpha != m_GlowAlpha )
{
UpdateGlowEffect();
}
@ -106,11 +112,13 @@ void C_BaseCombatCharacter::DoMuzzleFlash()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b )
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b, float *a )
{
*r = 0.76f;
*g = 0.76f;
*b = 0.76f;
*r = m_GlowColor.x;
*g = m_GlowColor.y;
*b = m_GlowColor.z;
if (a)
*a = m_GlowAlpha;
}
//-----------------------------------------------------------------------------
@ -127,10 +135,10 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void )
// create a new effect
if ( m_bGlowEnabled )
{
float r, g, b;
GetGlowEffectColor( &r, &g, &b );
float r, g, b, a;
GetGlowEffectColor( &r, &g, &b, &a );
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), a, true );
}
}
@ -161,6 +169,8 @@ BEGIN_RECV_TABLE(C_BaseCombatCharacter, DT_BaseCombatCharacter)
RecvPropArray3( RECVINFO_ARRAY(m_hMyWeapons), RecvPropEHandle( RECVINFO( m_hMyWeapons[0] ) ) ),
#ifdef GLOWS_ENABLE
RecvPropBool( RECVINFO( m_bGlowEnabled ) ),
RecvPropVector( RECVINFO( m_GlowColor ) ),
RecvPropFloat( RECVINFO( m_GlowAlpha ) ),
#endif // GLOWS_ENABLE
#ifdef INVASION_CLIENT_DLL
@ -178,3 +188,39 @@ BEGIN_PREDICTION_DATA( C_BaseCombatCharacter )
DEFINE_PRED_ARRAY( m_hMyWeapons, FIELD_EHANDLE, MAX_WEAPONS, FTYPEDESC_INSENDTABLE ),
END_PREDICTION_DATA()
#ifdef MAPBASE_VSCRIPT
BEGIN_ENT_SCRIPTDESC( C_BaseCombatCharacter, C_BaseAnimating, "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAmmoCount, "GetAmmoCount", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetActiveWeapon, "GetActiveWeapon", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetWeapon, "GetWeapon", "" )
END_SCRIPTDESC();
int C_BaseCombatCharacter::ScriptGetAmmoCount( int i )
{
Assert( i == -1 || i < MAX_AMMO_SLOTS );
if ( i < 0 || i >= MAX_AMMO_SLOTS )
return NULL;
return GetAmmoCount( i );
}
HSCRIPT C_BaseCombatCharacter::ScriptGetActiveWeapon()
{
return ToHScript( GetActiveWeapon() );
}
HSCRIPT C_BaseCombatCharacter::ScriptGetWeapon( int i )
{
Assert( i >= 0 && i < MAX_WEAPONS );
if ( i < 0 || i >= MAX_WEAPONS )
return NULL;
return ToHScript( GetWeapon(i) );
}
#endif

View File

@ -29,6 +29,9 @@ class C_BaseCombatCharacter : public C_BaseFlex
public:
DECLARE_CLIENTCLASS();
DECLARE_PREDICTABLE();
#ifdef MAPBASE_VSCRIPT
DECLARE_ENT_SCRIPTDESC();
#endif
C_BaseCombatCharacter( void );
virtual ~C_BaseCombatCharacter( void );
@ -96,9 +99,15 @@ public:
#ifdef GLOWS_ENABLE
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
virtual void GetGlowEffectColor( float *r, float *g, float *b );
virtual void GetGlowEffectColor( float *r, float *g, float *b, float *a = NULL );
#endif // GLOWS_ENABLE
#ifdef MAPBASE_VSCRIPT
int ScriptGetAmmoCount( int i );
HSCRIPT ScriptGetActiveWeapon();
HSCRIPT ScriptGetWeapon( int i );
#endif
public:
float m_flNextAttack;
@ -124,6 +133,10 @@ private:
bool m_bGlowEnabled;
bool m_bOldGlowEnabled;
CGlowObject *m_pGlowEffect;
Vector m_GlowColor;
Vector m_OldGlowColor;
float m_GlowAlpha;
int m_OldGlowAlpha;
#endif // GLOWS_ENABLE
private:

View File

@ -125,9 +125,15 @@ void C_BaseCombatWeapon::OnRestore()
int C_BaseCombatWeapon::GetWorldModelIndex( void )
{
#ifdef MAPBASE
int iIndex = GetOwner() ? m_iWorldModelIndex.Get() : m_iDroppedModelIndex.Get();
#else
int iIndex = m_iWorldModelIndex.Get();
#endif
if ( GameRules() )
{
const char *pBaseName = modelinfo->GetModelName( modelinfo->GetModel( m_iWorldModelIndex ) );
const char *pBaseName = modelinfo->GetModelName( modelinfo->GetModel( iIndex ) );
const char *pTranslatedName = GameRules()->TranslateEffectForVisionFilter( "weapons", pBaseName );
if ( pTranslatedName != pBaseName )
@ -136,7 +142,7 @@ int C_BaseCombatWeapon::GetWorldModelIndex( void )
}
}
return m_iWorldModelIndex;
return iIndex;
}
//-----------------------------------------------------------------------------
@ -502,18 +508,36 @@ int C_BaseCombatWeapon::DrawModel( int flags )
// check if local player chases owner of this weapon in first person
C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
if ( localplayer && localplayer->IsObserver() && GetOwner() )
if ( localplayer )
{
#ifdef MAPBASE
if (localplayer->m_bDrawPlayerModelExternally)
{
// If this isn't the main view, draw the weapon.
view_id_t viewID = CurrentViewID();
if (viewID != VIEW_MAIN && viewID != VIEW_INTRO_CAMERA)
return BaseClass::DrawModel( flags );
if ( (!localplayer->InFirstPersonView() || (viewID != VIEW_MAIN && viewID != VIEW_INTRO_CAMERA)) && (viewID != VIEW_SHADOW_DEPTH_TEXTURE || !localplayer->IsEffectActive(EF_DIMLIGHT)) )
{
// TODO: Is this inefficient?
int nModelIndex = GetModelIndex();
int nWorldModelIndex = GetWorldModelIndex();
if (nModelIndex != nWorldModelIndex)
{
SetModelIndex(nWorldModelIndex);
}
int iDraw = BaseClass::DrawModel(flags);
if (nModelIndex != nWorldModelIndex)
{
SetModelIndex(nModelIndex);
}
return iDraw;
}
}
#endif
if ( localplayer->IsObserver() && GetOwner() )
{
// don't draw weapon if chasing this guy as spectator
// we don't check that in ShouldDraw() since this may change
// without notification
@ -522,6 +546,7 @@ int C_BaseCombatWeapon::DrawModel( int flags )
localplayer->GetObserverTarget() == GetOwner() )
return false;
}
}
return BaseClass::DrawModel( flags );
}

View File

@ -428,6 +428,11 @@ BEGIN_RECV_TABLE_NOBASE( C_BaseEntity, DT_AnimTimeMustBeFirst )
RecvPropInt( RECVINFO(m_flAnimTime), 0, RecvProxy_AnimTime ),
END_RECV_TABLE()
#ifdef MAPBASE_VSCRIPT
ScriptHook_t C_BaseEntity::g_Hook_UpdateOnRemove;
ScriptHook_t C_BaseEntity::g_Hook_ModifyEmitSoundParams;
#endif
BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities" )
DEFINE_SCRIPT_INSTANCE_HELPER( &g_BaseEntityScriptInstanceHelper )
DEFINE_SCRIPTFUNC_NAMED( GetAbsOrigin, "GetOrigin", "" )
@ -451,6 +456,7 @@ BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities
DEFINE_SCRIPTFUNC_NAMED( ScriptGetModelName, "GetModelName", "Returns the name of the model" )
DEFINE_SCRIPTFUNC_NAMED( ScriptStopSound, "StopSound", "Stops a sound from this entity." )
DEFINE_SCRIPTFUNC_NAMED( ScriptEmitSound, "EmitSound", "Plays a sound from this entity." )
DEFINE_SCRIPTFUNC_NAMED( VScriptPrecacheScriptSound, "PrecacheSoundScript", "Precache a sound for later playing." )
DEFINE_SCRIPTFUNC_NAMED( ScriptSoundDuration, "GetSoundDuration", "Returns float duration of the sound. Takes soundname and optional actormodelname." )
@ -472,12 +478,15 @@ BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities
DEFINE_SCRIPTFUNC_NAMED( GetAbsAngles, "GetAngles", "Get entity pitch, yaw, roll as a vector" )
DEFINE_SCRIPTFUNC_NAMED( SetAbsAngles, "SetAngles", "Set entity pitch, yaw, roll" )
DEFINE_SCRIPTFUNC( SetSize, "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoundingMins, "GetBoundingMins", "Get a vector containing min bounds, centered on object" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoundingMaxs, "GetBoundingMaxs", "Get a vector containing max bounds, centered on object" )
DEFINE_SCRIPTFUNC_NAMED( ScriptEntityToWorldTransform, "EntityToWorldTransform", "Get the entity's transform" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetPhysicsObject, "GetPhysicsObject", "Get the entity's physics object if it has one" )
DEFINE_SCRIPTFUNC_NAMED( ScriptPhysicsInitNormal, "PhysicsInitNormal", "Initializes the entity's physics object with the specified solid type, solid flags, and whether to start asleep" )
DEFINE_SCRIPTFUNC_NAMED( ScriptPhysicsDestroyObject, "PhysicsDestroyObject", "Destroys the entity's physics object" )
DEFINE_SCRIPTFUNC( GetWaterLevel, "Get current level of water submergence" )
@ -495,6 +504,9 @@ BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities
DEFINE_SCRIPTFUNC_NAMED( GetScriptOwnerEntity, "GetOwner", "Gets this entity's owner" )
DEFINE_SCRIPTFUNC_NAMED( SetScriptOwnerEntity, "SetOwner", "Sets this entity's owner" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetGroundEntity, "GetGroundEntity", "Get the entity we're standing on." )
DEFINE_SCRIPTFUNC_NAMED( ScriptSetGroundEntity, "SetGroundEntity", "Set the entity we're standing on." )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorVector, "GetRenderColorVector", "Get the render color as a vector" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorR, "GetRenderColorR", "Get the render color's R value" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorG, "GetRenderColorG", "Get the render color's G value" )
@ -541,8 +553,21 @@ BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities
DEFINE_SCRIPTFUNC_NAMED( IsBaseCombatWeapon, "IsWeapon", "Returns true if this entity is a weapon." )
DEFINE_SCRIPTFUNC( IsWorld, "Returns true if this entity is the world." )
DEFINE_SCRIPTFUNC( SetModel, "Set client-only entity model" )
//DEFINE_SCRIPTFUNC_NAMED( ScriptInitializeAsClientEntity, "InitializeAsClientEntity", "" )
DEFINE_SCRIPTFUNC_NAMED( Remove, "Destroy", "Remove clientside entity" )
DEFINE_SCRIPTFUNC_NAMED( GetEntityIndex, "entindex", "" )
#endif
DEFINE_SCRIPTFUNC_NAMED( ScriptSetContextThink, "SetContextThink", "Set a think function on this entity." )
DEFINE_SIMPLE_SCRIPTHOOK( C_BaseEntity::g_Hook_UpdateOnRemove, "UpdateOnRemove", FIELD_VOID, "Called when the entity is being removed." )
BEGIN_SCRIPTHOOK( C_BaseEntity::g_Hook_ModifyEmitSoundParams, "ModifyEmitSoundParams", FIELD_VOID, "Called every time a sound is emitted on this entity, allowing for its parameters to be modified." )
DEFINE_SCRIPTHOOK_PARAM( "params", FIELD_HSCRIPT )
END_SCRIPTHOOK()
#endif // MAPBASE_VSCRIPT
END_SCRIPTDESC();
@ -578,6 +603,7 @@ BEGIN_RECV_TABLE_NOBASE(C_BaseEntity, DT_BaseEntity)
RecvPropInt(RECVINFO(m_clrRender)),
#ifdef MAPBASE
RecvPropInt(RECVINFO(m_iViewHideFlags)),
RecvPropBool(RECVINFO(m_bDisableFlashlight)),
#endif
RecvPropInt(RECVINFO(m_iTeamNum)),
RecvPropInt(RECVINFO(m_CollisionGroup)),
@ -1331,8 +1357,23 @@ void C_BaseEntity::Term()
if ( m_hScriptInstance )
{
#ifdef MAPBASE_VSCRIPT
if ( m_ScriptScope.IsInitialized() && g_Hook_UpdateOnRemove.CanRunInScope( m_ScriptScope ) )
{
g_Hook_UpdateOnRemove.Call( m_ScriptScope, NULL, NULL );
}
#endif
g_pScriptVM->RemoveInstance( m_hScriptInstance );
m_hScriptInstance = NULL;
#ifdef MAPBASE_VSCRIPT
FOR_EACH_VEC( m_ScriptThinkFuncs, i )
{
HSCRIPT h = m_ScriptThinkFuncs[i]->m_hfnThink;
if ( h ) g_pScriptVM->ReleaseScript( h );
}
m_ScriptThinkFuncs.PurgeAndDeleteElements();
#endif
}
}
@ -1683,6 +1724,11 @@ bool C_BaseEntity::ShouldReceiveProjectedTextures( int flags )
if ( IsEffectActive( EF_NODRAW ) )
return false;
#ifdef MAPBASE
if ( m_bDisableFlashlight )
return false;
#endif
if( flags & SHADOW_FLAGS_FLASHLIGHT )
{
if ( GetRenderMode() > kRenderNormal && GetRenderColor().a == 0 )
@ -4891,9 +4937,15 @@ C_BaseEntity *C_BaseEntity::Instance( int iEnt )
}
#ifdef WIN32
#if _MSC_VER < 1900
#pragma warning( push )
#include <typeinfo.h>
#pragma warning( pop )
#else
#include <typeinfo>
#endif
#endif
//-----------------------------------------------------------------------------

View File

@ -161,6 +161,15 @@ struct thinkfunc_t
int m_nLastThinkTick;
};
#ifdef MAPBASE_VSCRIPT
struct scriptthinkfunc_t
{
float m_flNextThink;
HSCRIPT m_hfnThink;
unsigned m_iContextHash;
};
#endif
#define CREATE_PREDICTED_ENTITY( className ) \
C_BaseEntity::CreatePredictedEntityByName( className, __FILE__, __LINE__ );
@ -279,12 +288,20 @@ public:
HSCRIPT GetScriptOwnerEntity();
virtual void SetScriptOwnerEntity(HSCRIPT pOwner);
#ifdef MAPBASE_VSCRIPT
HSCRIPT ScriptGetGroundEntity();
void ScriptSetGroundEntity( HSCRIPT hGroundEnt );
#endif
HSCRIPT GetScriptInstance();
HSCRIPT m_hScriptInstance;
string_t m_iszScriptId;
#ifdef MAPBASE_VSCRIPT
CScriptScope m_ScriptScope;
static ScriptHook_t g_Hook_UpdateOnRemove;
static ScriptHook_t g_Hook_ModifyEmitSoundParams;
#endif
// IClientUnknown overrides.
@ -390,7 +407,7 @@ public:
#ifdef MAPBASE_VSCRIPT
// "I don't know why but wrapping entindex() works, while calling it directly crashes."
inline int C_BaseEntity::GetEntityIndex() const { return entindex(); }
inline int GetEntityIndex() const { return entindex(); }
#endif
// This works for client-only entities and returns the GetEntryIndex() of the entity's handle,
@ -1173,6 +1190,7 @@ public:
#ifdef MAPBASE_VSCRIPT
const char* ScriptGetModelName( void ) const { return STRING(GetModelName()); }
void ScriptStopSound(const char* soundname);
void ScriptEmitSound(const char* soundname);
float ScriptSoundDuration(const char* soundname, const char* actormodel);
@ -1188,6 +1206,8 @@ public:
HSCRIPT ScriptEntityToWorldTransform( void );
HSCRIPT ScriptGetPhysicsObject( void );
void ScriptPhysicsInitNormal( int nSolidType, int nSolidFlags, bool createAsleep );
void ScriptPhysicsDestroyObject() { VPhysicsDestroyObject(); }
void ScriptSetParent( HSCRIPT hParent, const char *szAttachment );
HSCRIPT ScriptGetMoveParent( void );
@ -1251,7 +1271,7 @@ public:
#ifdef _DEBUG
void FunctionCheck( void *pFunction, const char *name );
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name )
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name )
{
//COMPILE_TIME_ASSERT( sizeof(func) == 4 );
m_pfnTouch = func;
@ -1378,6 +1398,7 @@ public:
#ifdef MAPBASE
int m_iViewHideFlags;
bool m_bDisableFlashlight;
#endif
private:
@ -1518,6 +1539,15 @@ protected:
CUtlVector< thinkfunc_t > m_aThinkFunctions;
int m_iCurrentThinkContext;
#ifdef MAPBASE_VSCRIPT
public:
void ScriptSetContextThink( const char* szContext, HSCRIPT hFunc, float time );
void ScriptContextThink();
private:
CUtlVector< scriptthinkfunc_t* > m_ScriptThinkFuncs;
public:
#endif
// Object eye position
Vector m_vecViewOffset;

View File

@ -15,7 +15,7 @@
#include "ammodef.h"
#include "vprof.h"
#include "view.h"
#include "vstdlib/ikeyvaluessystem.h"
#include "vstdlib/IKeyValuesSystem.h"
#ifdef MAPBASE
#include "usermessages.h"
#endif
@ -666,7 +666,8 @@ void CIconLesson::UpdateInactive()
CUtlBuffer msg_data;
msg_data.PutChar( 1 );
msg_data.PutString( m_szHudHint.String() );
usermessages->DispatchUserMessage( usermessages->LookupUserMessage( "KeyHintText" ), bf_read( msg_data.Base(), msg_data.TellPut() ) );
bf_read msg( msg_data.Base(), msg_data.TellPut() );
usermessages->DispatchUserMessage( usermessages->LookupUserMessage( "KeyHintText" ), msg );
}
#endif
@ -1039,40 +1040,40 @@ Vector CIconLesson::GetIconTargetPosition( C_BaseEntity *pIconTarget )
#define LESSON_VARIABLE_INIT_SYMBOL( _varEnum, _varName, _varType ) g_n##_varEnum##Symbol = KeyValuesSystem()->GetSymbolForString( #_varEnum );
#define LESSON_SCRIPT_STRING_ADD_TO_MAP( _varEnum, _varName, _varType ) g_NameToTypeMap.Insert( #_varEnum, LESSON_VARIABLE_##_varEnum## );
#define LESSON_SCRIPT_STRING_ADD_TO_MAP( _varEnum, _varName, _varType ) g_NameToTypeMap.Insert( #_varEnum, LESSON_VARIABLE_##_varEnum );
// Create enum value
#define LESSON_VARIABLE_ENUM( _varEnum, _varName, _varType ) LESSON_VARIABLE_##_varEnum##,
#define LESSON_VARIABLE_ENUM( _varEnum, _varName, _varType ) LESSON_VARIABLE_##_varEnum,
// Init info call
#define LESSON_VARIABLE_INIT_INFO_CALL( _varEnum, _varName, _varType ) g_pLessonVariableInfo[ LESSON_VARIABLE_##_varEnum## ].Init_##_varEnum##();
#define LESSON_VARIABLE_INIT_INFO_CALL( _varEnum, _varName, _varType ) g_pLessonVariableInfo[ LESSON_VARIABLE_##_varEnum ].Init_##_varEnum();
// Init info
#define LESSON_VARIABLE_INIT_INFO( _varEnum, _varName, _varType ) \
void Init_##_varEnum##() \
void Init_##_varEnum() \
{ \
iOffset = offsetof( CScriptedIconLesson, CScriptedIconLesson::##_varName## ); \
iOffset = offsetof( CScriptedIconLesson, CScriptedIconLesson::_varName ); \
varType = LessonParamTypeFromString( #_varType ); \
}
#define LESSON_VARIABLE_INIT_INFO_BOOL( _varEnum, _varName, _varType ) \
void Init_##_varEnum##() \
void Init_##_varEnum() \
{ \
iOffset = offsetof( CScriptedIconLesson, CScriptedIconLesson::##_varName## ); \
iOffset = offsetof( CScriptedIconLesson, CScriptedIconLesson::_varName ); \
varType = FIELD_BOOLEAN; \
}
#define LESSON_VARIABLE_INIT_INFO_EHANDLE( _varEnum, _varName, _varType ) \
void Init_##_varEnum##() \
void Init_##_varEnum() \
{ \
iOffset = offsetof( CScriptedIconLesson, CScriptedIconLesson::##_varName## ); \
iOffset = offsetof( CScriptedIconLesson, CScriptedIconLesson::_varName ); \
varType = FIELD_EHANDLE; \
}
#define LESSON_VARIABLE_INIT_INFO_STRING( _varEnum, _varName, _varType ) \
void Init_##_varEnum##() \
void Init_##_varEnum() \
{ \
iOffset = offsetof( CScriptedIconLesson, CScriptedIconLesson::##_varName## ); \
iOffset = offsetof( CScriptedIconLesson, CScriptedIconLesson::_varName ); \
varType = FIELD_STRING; \
}
@ -1094,15 +1095,15 @@ Vector CIconLesson::GetIconTargetPosition( C_BaseEntity *pIconTarget )
// Process the element action on this variable
#define PROCESS_LESSON_ACTION( _varEnum, _varName, _varType ) \
case LESSON_VARIABLE_##_varEnum##:\
case LESSON_VARIABLE_##_varEnum:\
return ProcessElementAction( pLessonElement->iAction, pLessonElement->bNot, #_varName, _varName, &pLessonElement->szParam, eventParam_float );
#define PROCESS_LESSON_ACTION_EHANDLE( _varEnum, _varName, _varType ) \
case LESSON_VARIABLE_##_varEnum##:\
case LESSON_VARIABLE_##_varEnum:\
return ProcessElementAction( pLessonElement->iAction, pLessonElement->bNot, #_varName, _varName, &pLessonElement->szParam, eventParam_float, eventParam_BaseEntity, eventParam_string );
#define PROCESS_LESSON_ACTION_STRING( _varEnum, _varName, _varType ) \
case LESSON_VARIABLE_##_varEnum##:\
case LESSON_VARIABLE_##_varEnum:\
return ProcessElementAction( pLessonElement->iAction, pLessonElement->bNot, #_varName, &_varName, &pLessonElement->szParam, eventParam_string );
// Init the variable from the script (or a convar)
@ -2957,7 +2958,7 @@ bool CScriptedIconLesson::ProcessElementAction( int iAction, bool bNot, const ch
{
if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
{
ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HealthFraction() ", pchVarName, pchVarName );
ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HealthFraction() ", pchVarName );
ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( ">= [%s] " ) : ( "< [%s] " ), pchParamName->String() );
ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%f\n", fParam );
@ -2969,7 +2970,7 @@ bool CScriptedIconLesson::ProcessElementAction( int iAction, bool bNot, const ch
if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
{
ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HealthFraction() ", pchVarName, pchVarName );
ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HealthFraction() ", pchVarName );
ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%f ", pVar->HealthFraction() );
ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( ">= [%s] " ) : ( "< [%s] " ), pchParamName->String() );
ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%f\n", fParam );

View File

@ -426,7 +426,7 @@ private:
LessonEvent_t * AddUpdateEvent( void );
private:
static CUtlDict< int, int > CScriptedIconLesson::LessonActionMap;
static CUtlDict< int, int > LessonActionMap;
EHANDLE m_hLocalPlayer;
float m_fOutput;

View File

@ -281,6 +281,7 @@ END_RECV_TABLE()
RecvPropInt ( RECVINFO( m_spawnflags ), 0, RecvProxy_ShiftPlayerSpawnflags ),
RecvPropBool ( RECVINFO( m_bDrawPlayerModelExternally ) ),
RecvPropBool ( RECVINFO( m_bInTriggerFall ) ),
#endif
END_RECV_TABLE()
@ -331,7 +332,10 @@ END_RECV_TABLE()
RecvPropString( RECVINFO(m_szLastPlaceName) ),
RecvPropEHandle(RECVINFO(m_hPostProcessCtrl)), // Send to everybody - for spectating
#ifdef MAPBASE // From Alien Swarm SDK
RecvPropEHandle( RECVINFO( m_hPostProcessCtrl ) ), // Send to everybody - for spectating
RecvPropEHandle( RECVINFO( m_hColorCorrectionCtrl ) ), // Send to everybody - for spectating
#endif
#if defined USES_ECON_ITEMS
RecvPropUtlVector( RECVINFO_UTLVECTOR( m_hMyWearables ), MAX_WEARABLES_SENT_FROM_SERVER, RecvPropEHandle(NULL, 0, 0) ),
@ -1129,6 +1133,9 @@ void C_BasePlayer::DetermineVguiInputMode( CUserCmd *pCmd )
// Kill all attack inputs if we're in vgui screen mode
pCmd->buttons &= ~(IN_ATTACK | IN_ATTACK2 | IN_VALIDVGUIINPUT);
#ifdef MAPBASE
pCmd->buttons |= IN_VGUIMODE;
#endif // MAPBASE
return;
}
#else
@ -1138,6 +1145,10 @@ void C_BasePlayer::DetermineVguiInputMode( CUserCmd *pCmd )
// Kill all attack inputs if we're in vgui screen mode
pCmd->buttons &= ~(IN_ATTACK | IN_ATTACK2);
#ifdef MAPBASE
pCmd->buttons &= ~(IN_USE | IN_ATTACK3);
pCmd->buttons |= IN_VGUIMODE;
#endif // MAPBASE
return;
}
#endif
@ -1202,6 +1213,10 @@ void C_BasePlayer::DetermineVguiInputMode( CUserCmd *pCmd )
// Kill all attack inputs if we're in vgui screen mode
pCmd->buttons &= ~(IN_ATTACK | IN_ATTACK2);
#ifdef MAPBASE
pCmd->buttons &= ~(IN_USE | IN_ATTACK3);
pCmd->buttons |= IN_VGUIMODE;
#endif // MAPBASE
}
}
@ -1363,6 +1378,10 @@ void C_BasePlayer::AddEntity( void )
// Add in lighting effects
CreateLightEffects();
#ifdef MAPBASE
SetLocalAnglesDim( X_INDEX, 0 );
#endif
}
extern float UTIL_WaterLevel( const Vector &position, float minz, float maxz );
@ -1485,8 +1504,9 @@ int C_BasePlayer::DrawModel( int flags )
if (m_bDrawPlayerModelExternally)
{
// Draw the player in any view except the main or "intro" view, both of which are default first-person views.
// HACKHACK: Also don't draw in shadow depth textures if the player's flashlight is on, as that causes the playermodel to block it.
view_id_t viewID = CurrentViewID();
if (viewID == VIEW_MAIN || viewID == VIEW_INTRO_CAMERA)
if (viewID == VIEW_MAIN || viewID == VIEW_INTRO_CAMERA || (viewID == VIEW_SHADOW_DEPTH_TEXTURE && IsEffectActive(EF_DIMLIGHT)))
{
// Make sure the player model wouldn't draw anyway...
if (!ShouldDrawThisPlayer())
@ -1509,6 +1529,38 @@ int C_BasePlayer::DrawModel( int flags )
return BaseClass::DrawModel( flags );
}
#ifdef MAPBASE
ConVar cl_player_allow_thirdperson_projtex( "cl_player_allow_thirdperson_projtex", "1", FCVAR_NONE, "Allows players to receive projected textures if they're non-local or in third person." );
ConVar cl_player_allow_thirdperson_rttshadows( "cl_player_allow_thirdperson_rttshadows", "0", FCVAR_NONE, "Allows players to cast RTT shadows if they're non-local or in third person." );
ConVar cl_player_allow_firstperson_projtex( "cl_player_allow_firstperson_projtex", "1", FCVAR_NONE, "Allows players to receive projected textures even if they're in first person." );
ConVar cl_player_allow_firstperson_rttshadows( "cl_player_allow_firstperson_rttshadows", "0", FCVAR_NONE, "Allows players to cast RTT shadows even if they're in first person." );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
ShadowType_t C_BasePlayer::ShadowCastType()
{
if ( (!IsLocalPlayer() || ShouldDraw()) ? !cl_player_allow_thirdperson_rttshadows.GetBool() : !cl_player_allow_firstperson_rttshadows.GetBool() )
return SHADOWS_NONE;
if ( !IsVisible() )
return SHADOWS_NONE;
return SHADOWS_RENDER_TO_TEXTURE_DYNAMIC;
}
//-----------------------------------------------------------------------------
// Should this object receive shadows?
//-----------------------------------------------------------------------------
bool C_BasePlayer::ShouldReceiveProjectedTextures( int flags )
{
if ( (!IsLocalPlayer() || ShouldDraw()) ? !cl_player_allow_thirdperson_projtex.GetBool() : !cl_player_allow_firstperson_projtex.GetBool() )
return false;
return BaseClass::ShouldReceiveProjectedTextures( flags );
}
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@ -2917,6 +2969,7 @@ void C_BasePlayer::UpdateFogBlend( void )
}
}
#ifdef MAPBASE // From Alien Swarm SDK
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
@ -2925,6 +2978,15 @@ C_PostProcessController* C_BasePlayer::GetActivePostProcessController() const
return m_hPostProcessCtrl.Get();
}
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
C_ColorCorrection* C_BasePlayer::GetActiveColorCorrection() const
{
return m_hColorCorrectionCtrl.Get();
}
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------

View File

@ -23,7 +23,10 @@
#include "hintsystem.h"
#include "SoundEmitterSystem/isoundemittersystembase.h"
#include "c_env_fog_controller.h"
#ifdef MAPBASE // From Alien Swarm SDK
#include "c_postprocesscontroller.h"
#include "c_colorcorrection.h"
#endif
#include "igameevents.h"
#include "GameEventListener.h"
@ -204,6 +207,11 @@ public:
void SetMaxSpeed( float flMaxSpeed ) { m_flMaxspeed = flMaxSpeed; }
float MaxSpeed() const { return m_flMaxspeed; }
#ifdef MAPBASE
// See c_baseplayer.cpp
virtual ShadowType_t ShadowCastType();
virtual bool ShouldReceiveProjectedTextures( int flags );
#else
// Should this object cast shadows?
virtual ShadowType_t ShadowCastType() { return SHADOWS_NONE; }
@ -211,6 +219,7 @@ public:
{
return false;
}
#endif
bool IsLocalPlayer( void ) const;
@ -381,7 +390,10 @@ public:
void UpdateFogController( void );
void UpdateFogBlend( void );
#ifdef MAPBASE // From Alien Swarm SDK
C_PostProcessController* GetActivePostProcessController() const;
C_ColorCorrection* GetActiveColorCorrection() const;
#endif
float GetFOVTime( void ){ return m_flFOVTime; }
@ -458,6 +470,8 @@ public:
// Allows the player's model to draw on non-main views, like monitors or mirrors.
bool m_bDrawPlayerModelExternally;
bool m_bInTriggerFall;
#endif
protected:
@ -645,7 +659,10 @@ private:
// One for left and one for right side of step
StepSoundCache_t m_StepSoundCache[ 2 ];
CNetworkHandle(C_PostProcessController, m_hPostProcessCtrl); // active postprocessing controller
#ifdef MAPBASE // From Alien Swarm SDK
CNetworkHandle( C_PostProcessController, m_hPostProcessCtrl ); // active postprocessing controller
CNetworkHandle( C_ColorCorrection, m_hColorCorrectionCtrl ); // active FXVolume color correction
#endif
public:

View File

@ -192,7 +192,7 @@ bool C_BaseViewModel::Interpolate( float currentTime )
}
inline bool C_BaseViewModel::ShouldFlipViewModel()
bool C_BaseViewModel::ShouldFlipViewModel()
{
#if defined(CSTRIKE_DLL) || defined (MAPBASE)
// If cl_righthand is set, then we want them all right-handed.

View File

@ -6,6 +6,7 @@
//===========================================================================//
#include "cbase.h"
#include "c_colorcorrection.h"
#include "filesystem.h"
#include "cdll_client_int.h"
#include "colorcorrectionmgr.h"
@ -17,45 +18,27 @@
static ConVar mat_colcorrection_disableentities( "mat_colcorrection_disableentities", "0", FCVAR_NONE, "Disable map color-correction entities" );
//------------------------------------------------------------------------------
// Purpose : Color correction entity with radial falloff
//------------------------------------------------------------------------------
class C_ColorCorrection : public C_BaseEntity
{
public:
DECLARE_CLASS( C_ColorCorrection, C_BaseEntity );
DECLARE_CLIENTCLASS();
C_ColorCorrection();
virtual ~C_ColorCorrection();
void OnDataChanged(DataUpdateType_t updateType);
bool ShouldDraw();
void ClientThink();
private:
Vector m_vecOrigin;
float m_minFalloff;
float m_maxFalloff;
float m_flCurWeight;
char m_netLookupFilename[MAX_PATH];
bool m_bEnabled;
ClientCCHandle_t m_CCHandle;
};
#ifdef MAPBASE // From Alien Swarm SDK
static ConVar mat_colcorrection_forceentitiesclientside( "mat_colcorrection_forceentitiesclientside", "0", FCVAR_CHEAT, "Forces color correction entities to be updated on the client" );
#endif
IMPLEMENT_CLIENTCLASS_DT(C_ColorCorrection, DT_ColorCorrection, CColorCorrection)
RecvPropVector( RECVINFO(m_vecOrigin) ),
RecvPropFloat( RECVINFO(m_minFalloff) ),
RecvPropFloat( RECVINFO(m_maxFalloff) ),
RecvPropFloat( RECVINFO(m_flCurWeight) ),
#ifdef MAPBASE // From Alien Swarm SDK
RecvPropFloat( RECVINFO(m_flMaxWeight) ),
RecvPropFloat( RECVINFO(m_flFadeInDuration) ),
RecvPropFloat( RECVINFO(m_flFadeOutDuration) ),
#endif
RecvPropString( RECVINFO(m_netLookupFilename) ),
RecvPropBool( RECVINFO(m_bEnabled) ),
#ifdef MAPBASE // From Alien Swarm SDK
RecvPropBool( RECVINFO(m_bMaster) ),
RecvPropBool( RECVINFO(m_bClientSide) ),
RecvPropBool( RECVINFO(m_bExclusive) )
#endif
END_RECV_TABLE()
@ -65,14 +48,43 @@ END_RECV_TABLE()
//------------------------------------------------------------------------------
C_ColorCorrection::C_ColorCorrection()
{
#ifdef MAPBASE // From Alien Swarm SDK
m_minFalloff = -1.0f;
m_maxFalloff = -1.0f;
m_flFadeInDuration = 0.0f;
m_flFadeOutDuration = 0.0f;
m_flCurWeight = 0.0f;
m_flMaxWeight = 1.0f;
m_netLookupFilename[0] = '\0';
m_bEnabled = false;
m_bMaster = false;
m_bExclusive = false;
#endif
m_CCHandle = INVALID_CLIENT_CCHANDLE;
#ifdef MAPBASE // From Alien Swarm SDK
m_bFadingIn = false;
m_flFadeStartWeight = 0.0f;
m_flFadeStartTime = 0.0f;
m_flFadeDuration = 0.0f;
#endif
}
C_ColorCorrection::~C_ColorCorrection()
{
#ifdef MAPBASE // From Alien Swarm SDK
g_pColorCorrectionMgr->RemoveColorCorrectionEntity( this, m_CCHandle );
#else
g_pColorCorrectionMgr->RemoveColorCorrection( m_CCHandle );
#endif
}
#ifdef MAPBASE // From Alien Swarm SDK
bool C_ColorCorrection::IsClientSide() const
{
return m_bClientSide || mat_colcorrection_forceentitiesclientside.GetBool();
}
#endif
//------------------------------------------------------------------------------
// Purpose :
@ -87,11 +99,21 @@ void C_ColorCorrection::OnDataChanged(DataUpdateType_t updateType)
{
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
{
#ifdef MAPBASE // From Alien Swarm SDK
// forming a unique name without extension
char cleanName[MAX_PATH];
V_StripExtension( m_netLookupFilename, cleanName, sizeof( cleanName ) );
char name[MAX_PATH];
Q_snprintf( name, MAX_PATH, "%s_%d", cleanName, entindex() );
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrectionEntity( this, name, m_netLookupFilename );
#else
char filename[MAX_PATH];
Q_strncpy( filename, m_netLookupFilename, MAX_PATH );
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrection( filename );
SetNextClientThink( ( m_CCHandle != INVALID_CLIENT_CCHANDLE ) ? CLIENT_THINK_ALWAYS : CLIENT_THINK_NEVER );
#endif
}
}
}
@ -104,6 +126,129 @@ bool C_ColorCorrection::ShouldDraw()
return false;
}
#ifdef MAPBASE // From Alien Swarm SDK
void C_ColorCorrection::Update( C_BasePlayer *pPlayer, float ccScale )
{
Assert( m_CCHandle != INVALID_CLIENT_CCHANDLE );
if ( mat_colcorrection_disableentities.GetInt() )
{
// Allow the colorcorrectionui panel (or user) to turn off color-correction entities
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, 0.0f, m_bExclusive );
return;
}
// fade weight on client
if ( IsClientSide() )
{
m_flCurWeight = Lerp( GetFadeRatio(), m_flFadeStartWeight, m_bFadingIn ? m_flMaxWeight : 0.0f );
}
if( !m_bEnabled && m_flCurWeight == 0.0f )
{
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, 0.0f, m_bExclusive );
return;
}
Vector playerOrigin = pPlayer->GetAbsOrigin();
float weight = 0;
if ( ( m_minFalloff != -1 ) && ( m_maxFalloff != -1 ) && m_minFalloff != m_maxFalloff )
{
float dist = (playerOrigin - m_vecOrigin).Length();
weight = (dist-m_minFalloff) / (m_maxFalloff-m_minFalloff);
if ( weight<0.0f ) weight = 0.0f;
if ( weight>1.0f ) weight = 1.0f;
}
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, m_flCurWeight * ( 1.0 - weight ) * ccScale, m_bExclusive );
}
void C_ColorCorrection::EnableOnClient( bool bEnable, bool bSkipFade )
{
if ( !IsClientSide() )
{
return;
}
m_bFadingIn = bEnable;
// initialize countdown timer
m_flFadeStartWeight = m_flCurWeight;
float flFadeTimeScale = 1.0f;
if ( m_flMaxWeight != 0.0f )
{
flFadeTimeScale = m_flCurWeight / m_flMaxWeight;
}
if ( m_bFadingIn )
{
flFadeTimeScale = 1.0f - flFadeTimeScale;
}
if ( bSkipFade )
{
flFadeTimeScale = 0.0f;
}
StartFade( flFadeTimeScale * ( m_bFadingIn ? m_flFadeInDuration : m_flFadeOutDuration ) );
// update the clientside weight once here, in case the fade duration is 0
m_flCurWeight = Lerp( GetFadeRatio(), m_flFadeStartWeight, m_bFadingIn ? m_flMaxWeight : 0.0f );
}
Vector C_ColorCorrection::GetOrigin()
{
return m_vecOrigin;
}
float C_ColorCorrection::GetMinFalloff()
{
return m_minFalloff;
}
float C_ColorCorrection::GetMaxFalloff()
{
return m_maxFalloff;
}
void C_ColorCorrection::SetWeight( float fWeight )
{
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, fWeight, false );
}
void C_ColorCorrection::StartFade( float flDuration )
{
m_flFadeStartTime = gpGlobals->curtime;
m_flFadeDuration = MAX( flDuration, 0.0f );
}
float C_ColorCorrection::GetFadeRatio() const
{
float flRatio = 1.0f;
if ( m_flFadeDuration != 0.0f )
{
flRatio = ( gpGlobals->curtime - m_flFadeStartTime ) / m_flFadeDuration;
flRatio = clamp( flRatio, 0.0f, 1.0f );
}
return flRatio;
}
bool C_ColorCorrection::IsFadeTimeElapsed() const
{
return ( ( gpGlobals->curtime - m_flFadeStartTime ) > m_flFadeDuration ) ||
( ( gpGlobals->curtime - m_flFadeStartTime ) < 0.0f );
}
void UpdateColorCorrectionEntities( C_BasePlayer *pPlayer, float ccScale, C_ColorCorrection **pList, int listCount )
{
for ( int i = 0; i < listCount; i++ )
{
pList[i]->Update(pPlayer, ccScale);
}
}
#else
void C_ColorCorrection::ClientThink()
{
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
@ -141,6 +286,7 @@ void C_ColorCorrection::ClientThink()
BaseClass::ClientThink();
}
#endif

View File

@ -0,0 +1,88 @@
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
//
// Note that this header exists in the Alien Swarm SDK, but not in stock Source SDK 2013.
// Although technically a new Mapbase file, it only serves to move otherwise identical code,
// so most code and repo conventions will pretend it was always there.
//
// --------------------------------------------------------------------
//
// Purpose: Color correction entity with simple radial falloff
//
//=============================================================================//
#ifndef C_COLORCORRECTION_H
#define C_COLORCORRECTION_H
#ifdef _WIN32
#pragma once
#endif
#include "colorcorrectionmgr.h"
//------------------------------------------------------------------------------
// Purpose : Color correction entity with radial falloff
//------------------------------------------------------------------------------
class C_ColorCorrection : public C_BaseEntity
{
public:
DECLARE_CLASS( C_ColorCorrection, C_BaseEntity );
DECLARE_CLIENTCLASS();
C_ColorCorrection();
virtual ~C_ColorCorrection();
void OnDataChanged(DataUpdateType_t updateType);
bool ShouldDraw();
#ifdef MAPBASE // From Alien Swarm SDK
virtual void Update(C_BasePlayer *pPlayer, float ccScale);
bool IsMaster() const { return m_bMaster; }
bool IsClientSide() const;
bool IsExclusive() const { return m_bExclusive; }
void EnableOnClient( bool bEnable, bool bSkipFade = false );
Vector GetOrigin();
float GetMinFalloff();
float GetMaxFalloff();
void SetWeight( float fWeight );
protected:
void StartFade( float flDuration );
float GetFadeRatio() const;
bool IsFadeTimeElapsed() const;
#else
void ClientThink();
private:
#endif
Vector m_vecOrigin;
float m_minFalloff;
float m_maxFalloff;
float m_flCurWeight;
char m_netLookupFilename[MAX_PATH];
bool m_bEnabled;
#ifdef MAPBASE // From Alien Swarm SDK
float m_flFadeInDuration;
float m_flFadeOutDuration;
float m_flMaxWeight;
bool m_bMaster;
bool m_bClientSide;
bool m_bExclusive;
bool m_bFadingIn;
float m_flFadeStartWeight;
float m_flFadeStartTime;
float m_flFadeDuration;
#endif
ClientCCHandle_t m_CCHandle;
};
#endif

View File

@ -36,9 +36,26 @@ public:
void OnDataChanged(DataUpdateType_t updateType);
bool ShouldDraw();
#ifdef MAPBASE // From Alien Swarm SDK
void Update( C_BasePlayer *pPlayer, float ccScale );
void StartTouch( C_BaseEntity *pOther );
void EndTouch( C_BaseEntity *pOther );
#else
void ClientThink();
#endif
private:
#ifdef MAPBASE // From Alien Swarm SDK
float m_LastEnterWeight;
float m_LastEnterTime;
float m_LastExitWeight;
float m_LastExitTime;
bool m_bEnabled;
float m_MaxWeight;
float m_FadeDuration;
#endif
float m_Weight;
char m_lookupFilename[MAX_PATH];
@ -46,6 +63,11 @@ private:
};
IMPLEMENT_CLIENTCLASS_DT(C_ColorCorrectionVolume, DT_ColorCorrectionVolume, CColorCorrectionVolume)
#ifdef MAPBASE // From Alien Swarm SDK
RecvPropBool( RECVINFO( m_bEnabled ) ),
RecvPropFloat( RECVINFO( m_MaxWeight ) ),
RecvPropFloat( RECVINFO( m_FadeDuration ) ),
#endif
RecvPropFloat( RECVINFO(m_Weight) ),
RecvPropString( RECVINFO(m_lookupFilename) ),
END_RECV_TABLE()
@ -82,11 +104,21 @@ void C_ColorCorrectionVolume::OnDataChanged(DataUpdateType_t updateType)
{
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
{
#ifdef MAPBASE // From Alien Swarm SDK
// forming a unique name without extension
char cleanName[MAX_PATH];
V_StripExtension( m_lookupFilename, cleanName, sizeof( cleanName ) );
char name[MAX_PATH];
Q_snprintf( name, MAX_PATH, "%s_%d", cleanName, entindex() );
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrectionVolume( this, name, m_lookupFilename );
#else
char filename[MAX_PATH];
Q_strncpy( filename, m_lookupFilename, MAX_PATH );
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrection( filename );
SetNextClientThink( ( m_CCHandle != INVALID_CLIENT_CCHANDLE ) ? CLIENT_THINK_ALWAYS : CLIENT_THINK_NEVER );
#endif
}
}
}
@ -99,11 +131,95 @@ bool C_ColorCorrectionVolume::ShouldDraw()
return false;
}
#ifdef MAPBASE // From Alien Swarm SDK
//--------------------------------------------------------------------------------------------------------
void C_ColorCorrectionVolume::StartTouch( CBaseEntity *pEntity )
{
m_LastEnterTime = gpGlobals->curtime;
m_LastEnterWeight = m_Weight;
}
//--------------------------------------------------------------------------------------------------------
void C_ColorCorrectionVolume::EndTouch( CBaseEntity *pEntity )
{
m_LastExitTime = gpGlobals->curtime;
m_LastExitWeight = m_Weight;
}
void C_ColorCorrectionVolume::Update( C_BasePlayer *pPlayer, float ccScale )
{
if ( pPlayer )
{
bool isTouching = CollisionProp()->IsPointInBounds( pPlayer->EyePosition() );
bool wasTouching = m_LastEnterTime > m_LastExitTime;
if ( isTouching && !wasTouching )
{
StartTouch( pPlayer );
}
else if ( !isTouching && wasTouching )
{
EndTouch( pPlayer );
}
}
if( !m_bEnabled )
{
m_Weight = 0.0f;
}
else
{
if( m_LastEnterTime > m_LastExitTime )
{
// we most recently entered the volume
if( m_Weight < 1.0f )
{
float dt = gpGlobals->curtime - m_LastEnterTime;
float weight = m_LastEnterWeight + dt / ((1.0f-m_LastEnterWeight)*m_FadeDuration);
if( weight>1.0f )
weight = 1.0f;
m_Weight = weight;
}
}
else
{
// we most recently exitted the volume
if( m_Weight > 0.0f )
{
float dt = gpGlobals->curtime - m_LastExitTime;
float weight = (1.0f-m_LastExitWeight) + dt / (m_LastExitWeight*m_FadeDuration);
if( weight>1.0f )
weight = 1.0f;
m_Weight = 1.0f - weight;
}
}
}
// Vector entityPosition = GetAbsOrigin();
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, m_Weight * ccScale );
}
void UpdateColorCorrectionVolumes( C_BasePlayer *pPlayer, float ccScale, C_ColorCorrectionVolume **pList, int listCount )
{
for ( int i = 0; i < listCount; i++ )
{
pList[i]->Update(pPlayer, ccScale);
}
}
#else
void C_ColorCorrectionVolume::ClientThink()
{
Vector entityPosition = GetAbsOrigin();
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, m_Weight );
}
#endif

View File

@ -40,7 +40,10 @@ ConVar r_RainSplashPercentage( "r_RainSplashPercentage", "20", FCVAR_CHEAT ); //
ConVar r_RainParticleDensity( "r_RainParticleDensity", "1", FCVAR_NONE, "Density of Particle Rain 0-1" );
#ifdef MAPBASE
ConVar r_RainParticleClampOffset( "r_RainParticleClampOffset", "112", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems" );
ConVar r_RainParticleClampOffset_Rain( "r_RainParticleClampOffset_Rain", "120", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems using the 'Particle Rain' type." );
ConVar r_RainParticleClampOffset_Ash( "r_RainParticleClampOffset_Ash", "300", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems using the 'Particle Ash' type." );
ConVar r_RainParticleClampOffset_RainStorm( "r_RainParticleClampOffset_RainStorm", "112", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems using the 'Particle Rain Storm' type." );
ConVar r_RainParticleClampOffset_Snow( "r_RainParticleClampOffset_Snow", "300", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems using the 'Particle Snow' type." );
ConVar r_RainParticleClampDebug( "r_RainParticleClampDebug", "0", FCVAR_NONE, "Enables debug code for precipitation particle system clamping" );
#endif
@ -951,6 +954,70 @@ void CClient_Precipitation::CreateParticlePrecip( void )
UpdateParticlePrecip( pPlayer );
}
#ifdef MAPBASE
void CClient_Precipitation::ClampParticlePosition( Vector &vPlayerPos, Vector &vOffsetPos, Vector &vOffsetPosNear, Vector &vOffsetPosFar )
{
Vector mins, maxs;
modelinfo->GetModelBounds( GetModel(), mins, maxs );
// Account for precipitation height
maxs.z += 180;
Vector vecOrigin; //= WorldSpaceCenter();
VectorLerp( mins, maxs, 0.5f, vecOrigin );
maxs -= vecOrigin;
mins -= vecOrigin;
//float flMax = r_RainParticleClampOffset.GetFloat();
float flMax = 0;
switch (m_nPrecipType)
{
case PRECIPITATION_TYPE_PARTICLERAIN:
flMax = r_RainParticleClampOffset_Rain.GetFloat();
break;
case PRECIPITATION_TYPE_PARTICLEASH:
flMax = r_RainParticleClampOffset_Ash.GetFloat();
break;
case PRECIPITATION_TYPE_PARTICLERAINSTORM:
flMax = r_RainParticleClampOffset_RainStorm.GetFloat();
break;
case PRECIPITATION_TYPE_PARTICLESNOW:
flMax = r_RainParticleClampOffset_Snow.GetFloat();
break;
}
Vector addend( flMax, flMax, 0 );
mins += addend;
maxs -= addend;
if (flMax > 0)
{
// Unless this is extruding outwards, make sure the offset isn't inverting the bounds.
// This means precipitation triggers with bounds less than offset*2 will turn into a thin line
// and the involved precipitation will pretty much be spatial at all times, which is okay.
mins.x = clamp( mins.x, -FLT_MAX, -1 );
mins.y = clamp( mins.y, -FLT_MAX, -1 );
maxs.x = clamp( maxs.x, 1, FLT_MAX );
maxs.y = clamp( maxs.y, 1, FLT_MAX );
}
if (r_RainParticleClampDebug.GetBool())
debugoverlay->AddBoxOverlay( vecOrigin, mins, maxs, vec3_angle, 255, 0, 0, 128, 0.15f );
maxs += vecOrigin;
mins += vecOrigin;
CalcClosestPointOnAABB( mins, maxs, vPlayerPos, vPlayerPos );
CalcClosestPointOnAABB( mins, maxs, vOffsetPos, vOffsetPos );
CalcClosestPointOnAABB( mins, maxs, vOffsetPosNear, vOffsetPosNear );
CalcClosestPointOnAABB( mins, maxs, vOffsetPosFar, vOffsetPosFar );
}
#endif
void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer )
{
if ( !pPlayer )
@ -980,44 +1047,7 @@ void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer )
#ifdef MAPBASE
if (m_spawnflags & SF_PRECIP_PARTICLE_CLAMP)
{
Vector mins, maxs;
modelinfo->GetModelBounds( GetModel(), mins, maxs );
// Account for precipitation height
maxs.z += 180;
Vector vecOrigin; //= WorldSpaceCenter();
VectorLerp( mins, maxs, 0.5f, vecOrigin );
maxs -= vecOrigin;
mins -= vecOrigin;
float flMax = r_RainParticleClampOffset.GetFloat();
Vector addend( flMax, flMax, 0 );
mins += addend;
maxs -= addend;
if (flMax > 0)
{
// Unless this is extruding outwards, make sure the offset isn't inverting the bounds.
// This means precipitation triggers with bounds less than offset*2 will turn into a thin line
// and the involved precipitation will pretty much be spatial at all times, which is okay.
mins.x = clamp( mins.x, -FLT_MAX, -1 );
mins.y = clamp( mins.y, -FLT_MAX, -1 );
maxs.x = clamp( maxs.x, 1, FLT_MAX );
maxs.y = clamp( maxs.y, 1, FLT_MAX );
}
if (r_RainParticleClampDebug.GetBool())
debugoverlay->AddBoxOverlay( vecOrigin, mins, maxs, vec3_angle, 255, 0, 0, 128, 0.15f );
maxs += vecOrigin;
mins += vecOrigin;
CalcClosestPointOnAABB( mins, maxs, vPlayerPos, vPlayerPos );
CalcClosestPointOnAABB( mins, maxs, vOffsetPos, vOffsetPos );
CalcClosestPointOnAABB( mins, maxs, vOffsetPosNear, vOffsetPosNear );
CalcClosestPointOnAABB( mins, maxs, vOffsetPosFar, vOffsetPosFar );
ClampParticlePosition( vPlayerPos, vOffsetPos, vOffsetPosNear, vOffsetPosFar );
}
#endif
@ -1236,6 +1266,13 @@ void CClient_Precipitation::DispatchInnerParticlePrecip( C_BasePlayer *pPlayer,
Vector vOffsetPosFar = vPlayerPos + Vector ( 0, 0, 180 ) + ( vForward * m_flParticleInnerDist ); // 100.0
Vector vDensity = Vector( r_RainParticleDensity.GetFloat(), 0, 0 ) * m_flDensity;
#ifdef MAPBASE
if (m_spawnflags & SF_PRECIP_PARTICLE_CLAMP)
{
ClampParticlePosition( vPlayerPos, vOffsetPos, vOffsetPosNear, vOffsetPosFar );
}
#endif
#ifdef MAPBASE
if (!(m_spawnflags & SF_PRECIP_PARTICLE_NO_OUTER))
#endif

View File

@ -130,6 +130,10 @@ private:
void CreateAshParticle( void );
void CreateRainOrSnowParticle( Vector vSpawnPosition, Vector vVelocity );
#ifdef MAPBASE
void ClampParticlePosition( Vector &vPlayerPos, Vector &vOffsetPos, Vector &vOffsetPosNear, Vector &vOffsetPosFar );
#endif
// Information helpful in creating and rendering particles
IMaterial *m_MatHandle; // material used

View File

@ -25,6 +25,11 @@ ConVar cl_globallight_freeze( "cl_globallight_freeze", "0" );
// You can set these as KV anyway.
ConVar cl_globallight_xoffset( "cl_globallight_xoffset", "0" );
ConVar cl_globallight_yoffset( "cl_globallight_yoffset", "0" );
static ConVar cl_globallight_slopescaledepthbias_shadowmap( "cl_globallight_slopescaledepthbias_shadowmap", "16", FCVAR_CHEAT );
static ConVar cl_globallight_shadowfiltersize( "cl_globallight_shadowfiltersize", "0.1", FCVAR_CHEAT );
static ConVar cl_globallight_depthbias_shadowmap( "cl_globallight_depthbias_shadowmap", "0.00001", FCVAR_CHEAT );
static ConVar cl_globallight_depthres( "cl_globallight_depthres", "8192", FCVAR_CHEAT );
#else
ConVar cl_globallight_xoffset( "cl_globallight_xoffset", "-800" );
ConVar cl_globallight_yoffset( "cl_globallight_yoffset", "1600" );
@ -286,16 +291,21 @@ void C_GlobalLight::ClientThink()
state.m_bOrtho = false;
}
#ifndef MAPBASE // Don't draw that huge debug thing
#ifdef MAPBASE
//state.m_bDrawShadowFrustum = true; // Don't draw that huge debug thing
state.m_flShadowMapResolution = cl_globallight_depthres.GetFloat();
state.m_flShadowFilterSize = cl_globallight_shadowfiltersize.GetFloat();
state.m_flShadowSlopeScaleDepthBias = cl_globallight_slopescaledepthbias_shadowmap.GetFloat();
state.m_flShadowDepthBias = cl_globallight_depthbias_shadowmap.GetFloat();
state.m_bEnableShadows = m_bEnableShadows;
state.m_pSpotlightTexture = m_SpotlightTexture;
state.m_nSpotlightTextureFrame = m_nSpotlightTextureFrame;
#else
state.m_bDrawShadowFrustum = true;
#endif
/*state.m_flShadowSlopeScaleDepthBias = g_pMaterialSystemHardwareConfig->GetShadowSlopeScaleDepthBias();;
state.m_flShadowDepthBias = g_pMaterialSystemHardwareConfig->GetShadowDepthBias();*/
state.m_bEnableShadows = m_bEnableShadows;
state.m_pSpotlightTexture = m_SpotlightTexture;
#ifdef MAPBASE
state.m_nSpotlightTextureFrame = m_nSpotlightTextureFrame;
#else
state.m_nSpotlightTextureFrame = 0;
#endif

View File

@ -25,8 +25,8 @@
#include "tier0/memdbgon.h"
#ifdef ASW_PROJECTED_TEXTURES
static ConVar mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap", "16", FCVAR_CHEAT );
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.00001", FCVAR_CHEAT );
extern ConVarRef mat_slopescaledepthbias_shadowmap;
extern ConVarRef mat_depthbias_shadowmap;
float C_EnvProjectedTexture::m_flVisibleBBoxMinHeight = -FLT_MAX;
@ -60,6 +60,7 @@ IMPLEMENT_CLIENTCLASS_DT( C_EnvProjectedTexture, DT_EnvProjectedTexture, CEnvPro
RecvPropFloat( RECVINFO( m_flLinearAtten ) ),
RecvPropFloat( RECVINFO( m_flQuadraticAtten ) ),
RecvPropFloat( RECVINFO( m_flShadowAtten ) ),
RecvPropFloat( RECVINFO( m_flShadowFilter ) ),
RecvPropBool( RECVINFO( m_bAlwaysDraw ) ),
// Not needed on the client right now, change when it actually is needed
@ -97,6 +98,7 @@ C_EnvProjectedTexture *C_EnvProjectedTexture::Create( )
pEnt->m_flLinearAtten = 100.0f;
pEnt->m_flQuadraticAtten = 0.0f;
pEnt->m_flShadowAtten = 0.0f;
pEnt->m_flShadowFilter = 0.5f;
//pEnt->m_bProjectedTextureVersion = 1;
#endif
@ -283,6 +285,8 @@ void C_EnvProjectedTexture::UpdateLight( void )
// VectorNormalize( vRight );
// VectorNormalize( vUp );
VectorVectors( vForward, vRight, vUp );
}
}
else
@ -401,6 +405,7 @@ void C_EnvProjectedTexture::UpdateLight( void )
state.m_flShadowSlopeScaleDepthBias = mat_slopescaledepthbias_shadowmap.GetFloat();
state.m_flShadowDepthBias = mat_depthbias_shadowmap.GetFloat();
state.m_flShadowAtten = m_flShadowAtten;
state.m_flShadowFilterSize = m_flShadowFilter;
#else
state.m_fQuadraticAtten = 0.0;
state.m_fLinearAtten = 100;

View File

@ -48,6 +48,9 @@ protected:
int m_iCachedDesiredOverlay;
int m_iCurrentOverlay;
float m_flCurrentOverlayTime;
#ifdef MAPBASE
int m_iOverlayIndex;
#endif
};
IMPLEMENT_CLIENTCLASS_DT( C_EnvScreenOverlay, DT_EnvScreenOverlay, CEnvScreenOverlay )
@ -56,6 +59,9 @@ IMPLEMENT_CLIENTCLASS_DT( C_EnvScreenOverlay, DT_EnvScreenOverlay, CEnvScreenOve
RecvPropFloat( RECVINFO( m_flStartTime ) ),
RecvPropInt( RECVINFO( m_iDesiredOverlay ) ),
RecvPropBool( RECVINFO( m_bIsActive ) ),
#ifdef MAPBASE
RecvPropInt( RECVINFO( m_iOverlayIndex ) ),
#endif
END_RECV_TABLE()
//-----------------------------------------------------------------------------
@ -77,7 +83,11 @@ void C_EnvScreenOverlay::PostDataUpdate( DataUpdateType_t updateType )
BaseClass::PostDataUpdate( updateType );
// If we have a start time now, start the overlays going
#ifdef MAPBASE
if ( m_bIsActive && m_flStartTime > 0 && (view->GetScreenOverlayMaterial() == NULL || (m_iOverlayIndex != -1 && view->GetIndexedScreenOverlayMaterial(m_iOverlayIndex) == NULL)) )
#else
if ( m_bIsActive && m_flStartTime > 0 && view->GetScreenOverlayMaterial() == NULL )
#endif
{
StartOverlays();
}
@ -110,9 +120,18 @@ void C_EnvScreenOverlay::StopOverlays( void )
SetNextClientThink( CLIENT_THINK_NEVER );
if ( m_bWasActive && !m_bIsActive )
{
#ifdef MAPBASE
if (m_iOverlayIndex != -1)
{
view->SetIndexedScreenOverlayMaterial( m_iOverlayIndex, NULL );
}
else
#endif
{
view->SetScreenOverlayMaterial( NULL );
}
}
}
//-----------------------------------------------------------------------------
@ -162,9 +181,18 @@ void C_EnvScreenOverlay::StartCurrentOverlay( void )
// Bring up the current overlay
IMaterial *pMaterial = materials->FindMaterial( m_iszOverlayNames[m_iCurrentOverlay], TEXTURE_GROUP_CLIENT_EFFECTS, false );
if ( !IsErrorMaterial( pMaterial ) )
{
#ifdef MAPBASE
if (m_iOverlayIndex != -1)
{
view->SetIndexedScreenOverlayMaterial( m_iOverlayIndex, pMaterial );
}
else
#endif
{
view->SetScreenOverlayMaterial( pMaterial );
}
}
else
{
Warning("env_screenoverlay couldn't find overlay %s.\n", m_iszOverlayNames[m_iCurrentOverlay] );
@ -191,6 +219,11 @@ enum
SCREENEFFECT_EP2_ADVISOR_STUN,
SCREENEFFECT_EP1_INTRO,
SCREENEFFECT_EP2_GROGGY,
#ifdef MAPBASE
SCREENEFFECT_MAPBASE_CHROMATIC_BLUR = 100, // Overlays 3 different frames of red, green, and blue tints respectively with different offsets
SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION, // Similar to above, except it stretches frames in addition to offsetting them
#endif
};
// ============================================================================
@ -275,6 +308,21 @@ void C_EnvScreenEffect::ReceiveMessage( int classID, bf_read &msg )
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "ep2_groggy", pKeys );
g_pScreenSpaceEffects->EnableScreenSpaceEffect( "ep2_groggy" );
}
#ifdef MAPBASE
else if ( m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_BLUR || m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION )
{
if( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() < 80 )
return;
// Set our keys
pKeys->SetFloat( "duration", m_flDuration );
pKeys->SetInt( "fadeout", 0 );
pKeys->SetInt( "stretch", m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION );
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "mapbase_chromatic_aberration", pKeys );
g_pScreenSpaceEffects->EnableScreenSpaceEffect( "mapbase_chromatic_aberration" );
}
#endif
pKeys->deleteThis();
}
@ -321,6 +369,25 @@ void C_EnvScreenEffect::ReceiveMessage( int classID, bf_read &msg )
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "ep2_groggy", pKeys );
}
#ifdef MAPBASE
else if ( m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_BLUR || m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION )
{
if( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() < 80 )
return;
// Create a keyvalue block to set these params
KeyValues *pKeys = new KeyValues( "keys" );
if ( pKeys == NULL )
return;
// Set our keys
pKeys->SetFloat( "duration", m_flDuration );
pKeys->SetInt( "fadeout", 1 );
pKeys->SetInt( "stretch", m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION );
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "mapbase_chromatic_aberration", pKeys );
}
#endif
break;
}

View File

@ -9,7 +9,7 @@
#include "GameEventListener.h"
#include "vgui_controls/phandle.h"
#include "vgui_controls/PHandle.h"
class CBaseLesson;

View File

@ -95,18 +95,23 @@ extern PMaterialHandle g_Material_Spark;
//-----------------------------------------------------------------------------
void GetColorForSurface( trace_t *trace, Vector *color )
{
Vector baseColor, diffuseColor;
Vector end = trace->startpos + ( ( Vector )trace->endpos - ( Vector )trace->startpos ) * 1.1f;
Vector baseColor = vec3_invalid, diffuseColor;
const char *kind;
if ( trace->DidHitWorld() )
{
if ( trace->hitbox == 0 )
{
kind = "World";
Vector end = trace->startpos + ( trace->endpos - trace->startpos ) * 1.1f;
// If we hit the world, then ask the world for the fleck color
engine->TraceLineMaterialAndLighting( trace->startpos, end, diffuseColor, baseColor );
if ( !engine->TraceLineMaterialAndLighting( trace->startpos, end, diffuseColor, baseColor ) ) {
baseColor = vec3_invalid; // Make sure this wasn't modified
}
}
else
{
kind = "Static Prop";
// In this case we hit a static prop.
staticpropmgr->GetStaticPropMaterialColorAndLighting( trace, trace->hitbox - 1, diffuseColor, baseColor );
}
@ -117,13 +122,9 @@ void GetColorForSurface( trace_t *trace, Vector *color )
C_BaseEntity *pEnt = trace->m_pEnt;
if ( !pEnt )
{
Msg("Couldn't find surface in GetColorForSurface()\n");
color->x = 255;
color->y = 255;
color->z = 255;
return;
}
kind = "Null-Entity";
} else {
kind = "Entity";
ICollideable *pCollide = pEnt->GetCollideable();
int modelIndex = pCollide->GetCollisionModelIndex();
model_t* pModel = const_cast<model_t*>(modelinfo->GetModel( modelIndex ));
@ -132,6 +133,14 @@ void GetColorForSurface( trace_t *trace, Vector *color )
modelinfo->GetModelMaterialColorAndLighting( pModel, pCollide->GetCollisionOrigin(),
pCollide->GetCollisionAngles(), trace, diffuseColor, baseColor );
}
}
if ( baseColor == vec3_invalid )
{
Warning( "Couldn't find surface color of %s\n", kind );
baseColor = Vector( .5f, .5f, .5f );
diffuseColor = engine->GetLightForPoint( trace->endpos, true );
}
//Get final light value
color->x = pow( diffuseColor[0], 1.0f/2.2f ) * baseColor[0];

View File

@ -0,0 +1,27 @@
//========= Copyright © 1996-2009, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//
//=====================================================================================//
#include "cbase.h"
#include "c_movie_display.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
IMPLEMENT_CLIENTCLASS_DT( C_MovieDisplay, DT_MovieDisplay, CMovieDisplay )
RecvPropBool( RECVINFO( m_bEnabled ) ),
RecvPropBool( RECVINFO( m_bLooping ) ),
RecvPropBool( RECVINFO( m_bMuted ) ),
RecvPropString( RECVINFO( m_szMovieFilename ) ),
RecvPropString( RECVINFO( m_szGroupName ) ),
END_RECV_TABLE()
C_MovieDisplay::C_MovieDisplay()
{
}
C_MovieDisplay::~C_MovieDisplay()
{
}

View File

@ -0,0 +1,36 @@
//========= Copyright © 1996-2009, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=====================================================================================//
#ifndef C_MOVIE_DISPLAY_H
#define C_MOVIE_DISPLAY_H
#include "cbase.h"
class C_MovieDisplay : public C_BaseEntity
{
public:
DECLARE_CLASS( C_MovieDisplay, C_BaseEntity );
DECLARE_CLIENTCLASS();
C_MovieDisplay();
~C_MovieDisplay();
bool IsEnabled( void ) const { return m_bEnabled; }
bool IsLooping( void ) const { return m_bLooping; }
bool IsMuted(void) const { return m_bMuted; }
const char *GetMovieFilename( void ) const { return m_szMovieFilename; }
const char *GetGroupName( void ) const { return m_szGroupName; }
private:
bool m_bEnabled;
bool m_bLooping;
bool m_bMuted;
char m_szMovieFilename[128];
char m_szGroupName[128];
};
#endif //C_MOVIE_DISPLAY_H

View File

@ -42,6 +42,7 @@ protected:
EHANDLE m_hControlPointEnts[kMAXCONTROLPOINTS];
Vector m_vControlPointVecs[kMAXCONTROLPOINTS];
// SendPropArray3( SENDINFO_ARRAY3(m_iControlPointParents), SendPropInt( SENDINFO_ARRAY(m_iControlPointParents), 3, SPROP_UNSIGNED ) ),
unsigned char m_iControlPointParents[kMAXCONTROLPOINTS];
@ -65,6 +66,7 @@ BEGIN_RECV_TABLE_NOBASE( C_ParticleSystem, DT_ParticleSystem )
RecvPropFloat( RECVINFO( m_flStartTime ) ),
RecvPropArray3( RECVINFO_ARRAY(m_hControlPointEnts), RecvPropEHandle( RECVINFO( m_hControlPointEnts[0] ) ) ),
RecvPropArray3( RECVINFO_ARRAY(m_vControlPointVecs), RecvPropVector( RECVINFO( m_vControlPointVecs[0] ) ) ),
RecvPropArray3( RECVINFO_ARRAY(m_iControlPointParents), RecvPropInt( RECVINFO(m_iControlPointParents[0]))),
RecvPropBool( RECVINFO( m_bWeatherEffect ) ),
END_RECV_TABLE();
@ -149,6 +151,25 @@ void C_ParticleSystem::ClientThink( void )
CNewParticleEffect *pEffect = ParticleProp()->Create( pszName, PATTACH_ABSORIGIN_FOLLOW );
AssertMsg1( pEffect, "Particle system couldn't make %s", pszName );
if (pEffect)
{
if (m_vControlPointVecs[0] != GetAbsOrigin() && m_hControlPointEnts[0] == NULL)
{
// we are using info_particle_system_coordinate
for (int i = 0; i < kMAXCONTROLPOINTS; ++i)
{
ParticleProp()->AddControlPoint(pEffect, i + 1, this, PATTACH_WORLDORIGIN, 0, m_vControlPointVecs[i] - GetAbsOrigin());
AssertMsg2(m_iControlPointParents[i] >= 0 && m_iControlPointParents[i] <= kMAXCONTROLPOINTS,
"Particle system specified bogus control point parent (%d) for point %d.",
m_iControlPointParents[i], i);
if (m_iControlPointParents[i] != 0)
{
pEffect->SetControlPointParent(i + 1, m_iControlPointParents[i]);
}
}
}
else
{
for ( int i = 0 ; i < kMAXCONTROLPOINTS ; ++i )
{
@ -167,6 +188,7 @@ void C_ParticleSystem::ClientThink( void )
pEffect->SetControlPointParent(i+1, m_iControlPointParents[i]);
}
}
}
// NOTE: What we really want here is to compare our lifetime and that of our children and see if this delta is
// already past the end of it, denoting that we're finished. In that case, just destroy us and be done. -- jdw

File diff suppressed because it is too large Load Diff

View File

@ -73,6 +73,27 @@ IMPLEMENT_CLIENTCLASS_DT_NOBASE( C_RopeKeyframe, DT_RopeKeyframe, CRopeKeyframe
RecvPropInt( RECVINFO( m_iParentAttachment ) ),
END_RECV_TABLE()
#ifdef MAPBASE_VSCRIPT
BEGIN_ENT_SCRIPTDESC( C_RopeKeyframe, C_BaseEntity, "The clientside class of move_rope and keyframe_rope" )
DEFINE_SCRIPTFUNC( GetNodePosition, "Gets the position of the specified node index" )
DEFINE_SCRIPTFUNC( GetNumNodes, "Gets the number of nodes available" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetStartEntity, "GetStartEntity", "Gets the rope's start entity" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetEndEntity, "GetEndEntity", "Gets the rope's end entity" )
DEFINE_SCRIPTFUNC( SetupHangDistance, "Sets the rope's hang distance" )
DEFINE_SCRIPTFUNC( SetSlack, "Sets the rope's slack value (extra length)" )
DEFINE_SCRIPTFUNC( GetRopeFlags, "Gets the rope's flags" )
DEFINE_SCRIPTFUNC( SetRopeFlags, "Sets the rope's flags" )
DEFINE_SCRIPTFUNC( SetColorMod, "Sets the rope's color mod value" )
DEFINE_SCRIPTFUNC( ShakeRope, "Shakes the rope with the specified center, radius, and magnitude" )
DEFINE_SCRIPTFUNC( AnyPointsMoved, "Returns true if any points have moved recently" )
END_SCRIPTDESC();
#endif
#define ROPE_IMPULSE_SCALE 20
#define ROPE_IMPULSE_DECAY 0.95
@ -2022,6 +2043,25 @@ bool C_RopeKeyframe::GetAttachment( int number, Vector &origin, QAngle &angles )
return false;
}
#ifdef MAPBASE
const Vector &C_RopeKeyframe::GetNodePosition( int index )
{
int nNodes = m_RopePhysics.NumNodes();
if ( index >= nNodes || nNodes < 2 )
{
Warning( "C_RopeKeyframe::GetNodePosition(): Invalid node index %i (number of nodes is %i)\n", index, nNodes );
return vec3_origin;
}
return m_RopePhysics.GetNode( index )->m_vPredicted;
}
int C_RopeKeyframe::GetNumNodes()
{
return m_RopePhysics.NumNodes();
}
#endif
bool C_RopeKeyframe::AnyPointsMoved()
{
#ifdef MAPBASE

View File

@ -33,6 +33,9 @@ public:
DECLARE_CLASS( C_RopeKeyframe, C_BaseEntity );
DECLARE_CLIENTCLASS();
#ifdef MAPBASE_VSCRIPT
DECLARE_ENT_SCRIPTDESC();
#endif
private:
@ -142,6 +145,11 @@ public:
virtual bool GetAttachment( int number, Vector &origin );
virtual bool GetAttachmentVelocity( int number, Vector &originVel, Quaternion &angleVel );
#ifdef MAPBASE
const Vector &GetNodePosition( int index );
int GetNumNodes();
#endif
private:
void FinishInit( const char *pMaterialName );
@ -166,6 +174,11 @@ private:
void ReceiveMessage( int classID, bf_read &msg );
bool CalculateEndPointAttachment( C_BaseEntity *pEnt, int iAttachment, Vector &vPos, QAngle *pAngles );
#ifdef MAPBASE_VSCRIPT
HSCRIPT ScriptGetStartEntity() { return ToHScript( GetStartEntity() ); }
HSCRIPT ScriptGetEndEntity() { return ToHScript( GetEndEntity() ); }
#endif
private:
// Track which links touched something last frame. Used to prevent wind from gusting on them.

View File

@ -38,10 +38,14 @@ extern vgui::IInputInternal *g_InputInternal;
#define VGUI_SCREEN_MODE_RADIUS 80
//Precache the materials
CLIENTEFFECT_REGISTER_BEGIN( PrecacheEffectVGuiScreen )
CLIENTEFFECT_MATERIAL( "engine/writez" )
CLIENTEFFECT_REGISTER_BEGIN(PrecacheEffectVGuiScreen)
CLIENTEFFECT_MATERIAL("engine/writez")
CLIENTEFFECT_REGISTER_END()
#ifdef MAPBASE
C_EntityClassList<C_VGuiScreen> g_VGUIScreenList;
template <> C_VGuiScreen* C_EntityClassList<C_VGuiScreen>::m_pClassList = NULL;
#endif // MAPBASE
// ----------------------------------------------------------------------------- //
// This is a cache of preloaded keyvalues.
@ -102,11 +106,19 @@ C_VGuiScreen::C_VGuiScreen()
m_WriteZMaterial.Init( "engine/writez", TEXTURE_GROUP_VGUI );
m_OverlayMaterial.Init( m_WriteZMaterial );
#ifdef MAPBASE
g_VGUIScreenList.Insert(this);
#endif // MAPBASE
}
C_VGuiScreen::~C_VGuiScreen()
{
DestroyVguiScreen();
#ifdef MAPBASE
g_VGUIScreenList.Remove(this);
#endif // MAPBASE
}
//-----------------------------------------------------------------------------
@ -416,34 +428,69 @@ void C_VGuiScreen::ClientThink( void )
int px = (int)(u * m_nPixelWidth + 0.5f);
int py = (int)(v * m_nPixelHeight + 0.5f);
#ifndef MAPBASE
// Generate mouse input commands
if ((px != m_nOldPx) || (py != m_nOldPy))
{
g_InputInternal->InternalCursorMoved( px, py );
g_InputInternal->InternalCursorMoved(px, py);
m_nOldPx = px;
m_nOldPy = py;
}
if (m_nButtonPressed & IN_ATTACK)
{
g_InputInternal->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_PRESSED );
g_InputInternal->SetMouseCodeState(MOUSE_LEFT, vgui::BUTTON_PRESSED);
g_InputInternal->InternalMousePressed(MOUSE_LEFT);
}
if (m_nButtonPressed & IN_ATTACK2)
{
g_InputInternal->SetMouseCodeState( MOUSE_RIGHT, vgui::BUTTON_PRESSED );
g_InputInternal->InternalMousePressed( MOUSE_RIGHT );
g_InputInternal->SetMouseCodeState(MOUSE_RIGHT, vgui::BUTTON_PRESSED);
g_InputInternal->InternalMousePressed(MOUSE_RIGHT);
}
if ( (m_nButtonReleased & IN_ATTACK) || m_bLoseThinkNextFrame) // for a button release on loosing focus
if ((m_nButtonReleased & IN_ATTACK) || m_bLoseThinkNextFrame) // for a button release on loosing focus
{
g_InputInternal->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_RELEASED );
g_InputInternal->InternalMouseReleased( MOUSE_LEFT );
g_InputInternal->SetMouseCodeState(MOUSE_LEFT, vgui::BUTTON_RELEASED);
g_InputInternal->InternalMouseReleased(MOUSE_LEFT);
}
if (m_nButtonReleased & IN_ATTACK2)
{
g_InputInternal->SetMouseCodeState( MOUSE_RIGHT, vgui::BUTTON_RELEASED );
g_InputInternal->InternalMouseReleased( MOUSE_RIGHT );
g_InputInternal->SetMouseCodeState(MOUSE_RIGHT, vgui::BUTTON_RELEASED);
g_InputInternal->InternalMouseReleased(MOUSE_RIGHT);
}
#else
vgui::VPANEL focus = g_InputInternal->GetMouseOver();
// Generate mouse input commands
if ((px != m_nOldPx) || (py != m_nOldPy))
{
g_InputInternal->UpdateCursorPosInternal(px, py);
m_nOldPx = px;
m_nOldPy = py;
focus = pPanel->IsWithinTraverse(px, py, true);
g_InputInternal->SetMouseFocus(focus);
vgui::ivgui()->PostMessage(focus, new KeyValues("CursorMoved", "xpos", px, "ypos", py), NULL);
}
for (int i = 0; i < 2; i++)
{
const int nBit = i ? IN_ATTACK2 : (IN_ATTACK | IN_USE);
const vgui::MouseCode nButton = i ? MOUSE_RIGHT : MOUSE_LEFT;
if ((m_nButtonReleased & nBit) || ((m_nButtonState & nBit) && m_bLoseThinkNextFrame)) // for a button release on loosing focus
{
g_InputInternal->SetMouseCodeState(nButton, vgui::BUTTON_RELEASED);
vgui::ivgui()->PostMessage(focus, new KeyValues("MouseReleased", "code", nButton), NULL);
}
else if (m_nButtonPressed & nBit)
{
g_InputInternal->SetMouseCodeState(nButton, vgui::BUTTON_PRESSED);
vgui::ivgui()->PostMessage(focus, new KeyValues("MousePressed", "code", nButton), NULL);
}
}
#endif // !MAPBASE
if ( m_bLoseThinkNextFrame == true )
{
@ -627,6 +674,7 @@ bool C_VGuiScreen::IsInputOnlyToOwner( void )
return (m_fScreenFlags & VGUI_SCREEN_ONLY_USABLE_BY_OWNER) != 0;
}
#ifndef MAPBASE
//-----------------------------------------------------------------------------
//
// Enumator class for finding vgui screens close to the local player
@ -634,29 +682,29 @@ bool C_VGuiScreen::IsInputOnlyToOwner( void )
//-----------------------------------------------------------------------------
class CVGuiScreenEnumerator : public IPartitionEnumerator
{
DECLARE_CLASS_GAMEROOT( CVGuiScreenEnumerator, IPartitionEnumerator );
DECLARE_CLASS_GAMEROOT(CVGuiScreenEnumerator, IPartitionEnumerator);
public:
virtual IterationRetval_t EnumElement( IHandleEntity *pHandleEntity );
virtual IterationRetval_t EnumElement(IHandleEntity* pHandleEntity);
int GetScreenCount();
C_VGuiScreen *GetVGuiScreen( int index );
C_VGuiScreen* GetVGuiScreen(int index);
private:
CUtlVector< CHandle< C_VGuiScreen > > m_VguiScreens;
};
IterationRetval_t CVGuiScreenEnumerator::EnumElement( IHandleEntity *pHandleEntity )
IterationRetval_t CVGuiScreenEnumerator::EnumElement(IHandleEntity* pHandleEntity)
{
C_BaseEntity *pEnt = ClientEntityList().GetBaseEntityFromHandle( pHandleEntity->GetRefEHandle() );
if ( pEnt == NULL )
C_BaseEntity* pEnt = ClientEntityList().GetBaseEntityFromHandle(pHandleEntity->GetRefEHandle());
if (pEnt == NULL)
return ITERATION_CONTINUE;
// FIXME.. pretty expensive...
C_VGuiScreen *pScreen = dynamic_cast<C_VGuiScreen*>(pEnt);
if ( pScreen )
C_VGuiScreen* pScreen = dynamic_cast<C_VGuiScreen*>(pEnt);
if (pScreen)
{
int i = m_VguiScreens.AddToTail( );
m_VguiScreens[i].Set( pScreen );
int i = m_VguiScreens.AddToTail();
m_VguiScreens[i].Set(pScreen);
}
return ITERATION_CONTINUE;
@ -667,10 +715,12 @@ int CVGuiScreenEnumerator::GetScreenCount()
return m_VguiScreens.Count();
}
C_VGuiScreen *CVGuiScreenEnumerator::GetVGuiScreen( int index )
C_VGuiScreen* CVGuiScreenEnumerator::GetVGuiScreen(int index)
{
return m_VguiScreens[index].Get();
}
#endif // !MAPBASE
//-----------------------------------------------------------------------------
@ -704,18 +754,29 @@ C_BaseEntity *FindNearbyVguiScreen( const Vector &viewPosition, const QAngle &vi
Ray_t lookRay;
lookRay.Init( viewPosition, lookEnd );
#ifndef MAPBASE
// Look for vgui screens that are close to the player
CVGuiScreenEnumerator localScreens;
partition->EnumerateElementsInSphere( PARTITION_CLIENT_NON_STATIC_EDICTS, viewPosition, VGUI_SCREEN_MODE_RADIUS, false, &localScreens );
partition->EnumerateElementsInSphere(PARTITION_CLIENT_NON_STATIC_EDICTS, viewPosition, VGUI_SCREEN_MODE_RADIUS, false, &localScreens);
#endif // !MAPBASE
Vector vecOut, vecViewDelta;
float flBestDist = 2.0f;
C_VGuiScreen *pBestScreen = NULL;
#ifndef MAPBASE
for (int i = localScreens.GetScreenCount(); --i >= 0; )
#else
for (C_VGuiScreen* pScreen = g_VGUIScreenList.m_pClassList; pScreen != NULL; pScreen = pScreen->m_pNext)
#endif // !MAPBASE
{
C_VGuiScreen *pScreen = localScreens.GetVGuiScreen(i);
#ifndef MAPBASE
C_VGuiScreen* pScreen = localScreens.GetVGuiScreen(i);
#else
// Skip if out of PVS
if (pScreen->IsDormant())
continue;
#endif
if ( pScreen->IsAttachedToViewModel() )
continue;
@ -865,11 +926,21 @@ vgui::Panel *CVGuiScreenPanel::CreateControlByName(const char *controlName)
//-----------------------------------------------------------------------------
// Purpose: Called when the user presses a button
//-----------------------------------------------------------------------------
void CVGuiScreenPanel::OnCommand( const char *command)
void CVGuiScreenPanel::OnCommand(const char* command)
{
if ( Q_stricmp( command, "vguicancel" ) )
if (Q_stricmp(command, "vguicancel"))
{
engine->ClientCmd( const_cast<char *>( command ) );
#ifdef MAPBASE
if (m_hEntity && m_hEntity->IsServerEntity())
{
KeyValues* pCommand = new KeyValues("EntityCommand");
pCommand->SetInt("entindex", m_hEntity->index);
pCommand->SetString("command_data", command);
engine->ServerCmdKeyValues(pCommand);
}
else
#endif
engine->ClientCmd(const_cast<char*>(command));
}
BaseClass::OnCommand(command);

View File

@ -66,6 +66,10 @@ class C_VGuiScreen : public C_BaseEntity
public:
DECLARE_CLIENTCLASS();
#ifdef MAPBASE
C_VGuiScreen* m_pNext;
#endif // MAPBASE
C_VGuiScreen();
~C_VGuiScreen();
@ -112,6 +116,15 @@ public:
C_BasePlayer *GetPlayerOwner( void );
bool IsInputOnlyToOwner( void );
#ifdef MAPBASE
void GetSize( float &width, float &height ) const { width = m_flWidth; height = m_flHeight; }
void GetPixelSize( int &width, int &height ) const { width = m_nPixelWidth; height = m_nPixelHeight; }
void SetWidth( float flWidth ) { m_flWidth = flWidth; }
void SetHeight( float flHeight ) { m_flHeight = flHeight; }
void SetPixelWidth( int nWidth ) { m_nPixelWidth = nWidth; }
void SetPixelHeight( int nHeight ) { m_nPixelHeight = nHeight; }
#endif
private:
// Vgui screen management
void CreateVguiScreen( const char *pTypeName );

View File

@ -49,6 +49,8 @@ public:
#endif
#ifdef MAPBASE_VSCRIPT
void ClientThink() { ScriptContextThink(); }
// -2 = Use server language
ScriptLanguage_t GetScriptLanguage() { return (ScriptLanguage_t)(m_iScriptLanguageClient != -2 ? m_iScriptLanguageClient : m_iScriptLanguageServer); }
#endif

View File

@ -274,6 +274,8 @@ void ProcessCacheUsedMaterials()
}
}
void VGui_ClearVideoPanels();
// String tables
INetworkStringTable *g_pStringTableParticleEffectNames = NULL;
INetworkStringTable *g_StringTableEffectDispatch = NULL;
@ -1217,6 +1219,8 @@ void CHLClient::Shutdown( void )
g_pSixenseInput = NULL;
#endif
VGui_ClearVideoPanels();
C_BaseAnimating::ShutdownBoneSetupThreadPool();
ClientWorldFactoryShutdown();

View File

@ -166,7 +166,6 @@ inline bool FStrEq(const char *sz1, const char *sz2)
{
#ifdef MAPBASE
// V_stricmp() already checks if the pointers are equal, so having a comparison here is pointless.
// I had few reasons to do this, but maybe you'll thank me later.
return ( V_stricmp(sz1, sz2) == 0 );
#else
return ( sz1 == sz2 || V_stricmp(sz1, sz2) == 0 );

View File

@ -536,7 +536,6 @@ $Project
"$SRCDIR\public\dt_utlvector_recv.cpp" \
"$SRCDIR\public\filesystem_helpers.cpp" \
"$SRCDIR\public\interpolatortypes.cpp" \
"$SRCDIR\game\shared\interval.cpp" \
"$SRCDIR\common\language.cpp" \
"$SRCDIR\public\networkvar.cpp" \
"$SRCDIR\common\randoverride.cpp" \
@ -1107,6 +1106,7 @@ $Project
$File "$SRCDIR\public\vgui_controls\WizardSubPanel.h"
$File "$SRCDIR\public\worldsize.h"
$File "$SRCDIR\public\zip_uncompressed.h"
$File "$SRCDIR\public\tier1\interval.h"
//Haptics
$File "$SRCDIR\public\haptics\ihaptics.h" [$WIN32]
$File "$SRCDIR\public\haptics\haptic_utils.h" [$WIN32]
@ -1163,7 +1163,6 @@ $Project
$File "$SRCDIR\game\shared\igamesystem.h"
$File "$SRCDIR\game\shared\imovehelper.h"
$File "$SRCDIR\game\shared\in_buttons.h"
$File "$SRCDIR\game\shared\interval.h"
$File "$SRCDIR\game\shared\iplayeranimstate.h"
$File "$SRCDIR\game\shared\ipredictionsystem.h"
$File "$SRCDIR\game\shared\itempents.h"
@ -1261,6 +1260,9 @@ $Project
$Lib vtf
$ImpLib steam_api
// Discord integration
$Lib "$LIBPUBLIC\discord-rpc" [$MAPBASE_RPC&&!$LINUXALL]
$Lib $LIBCOMMON/libcrypto [$POSIX]
$ImpLib "$LIBCOMMON\curl" [$OSXALL]

View File

@ -10,8 +10,9 @@ $Configuration
{
$PreprocessorDefinitions "$BASE;ASW_PROJECTED_TEXTURES;DYNAMIC_RTT_SHADOWS;GLOWS_ENABLE"
$PreprocessorDefinitions "$BASE;MAPBASE_RPC;DISCORD_RPC;STEAM_RPC" [$MAPBASE_RPC]
$PreprocessorDefinitions "$BASE;MAPBASE_RPC;DISCORD_RPC;STEAM_RPC" [$MAPBASE_RPC&&!$LINUXALL]
$PreprocessorDefinitions "$BASE;MAPBASE_VSCRIPT" [$MAPBASE_VSCRIPT]
$PreprocessorDefinitions "$BASE;NEW_RESPONSE_SYSTEM" [$NEW_RESPONSE_SYSTEM]
}
}
@ -31,6 +32,10 @@ $Project
$File "c_postprocesscontroller.cpp"
$File "c_postprocesscontroller.h"
$File "c_env_dof_controller.cpp"
$File "c_movie_display.cpp"
$File "c_movie_display.h"
$File "vgui_movie_display.cpp"
$File "convarproxy.cpp"
$Folder "Mapbase"
{
@ -42,6 +47,8 @@ $Project
$File "$SRCDIR\game\shared\mapbase\MapEdit.h"
$File "$SRCDIR\game\shared\mapbase\matchers.cpp"
$File "$SRCDIR\game\shared\mapbase\matchers.h"
$File "$SRCDIR\game\shared\mapbase\singleplayer_animstate.cpp"
$File "$SRCDIR\game\shared\mapbase\singleplayer_animstate.h"
$File "$SRCDIR\game\shared\mapbase\vscript_funcs_shared.cpp" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_funcs_shared.h" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\vscript_singletons.cpp" [$MAPBASE_VSCRIPT]
@ -53,10 +60,17 @@ $Project
$File "$SRCDIR\game\shared\mapbase\weapon_custom_scripted.h" [$MAPBASE_VSCRIPT]
$File "$SRCDIR\game\shared\mapbase\logic_script_client.cpp" [$MAPBASE_VSCRIPT]
$File "mapbase\vscript_vgui.cpp" [$MAPBASE_VSCRIPT]
$File "mapbase\vscript_vgui.h" [$MAPBASE_VSCRIPT]
$File "mapbase\vscript_vgui.nut" [$MAPBASE_VSCRIPT]
$File "mapbase\c_func_clientclip.cpp"
$File "mapbase\c_func_fake_worldportal.cpp"
$File "mapbase\c_func_fake_worldportal.h"
$File "mapbase\c_point_glow.cpp"
$File "mapbase\c_vgui_text_display.cpp"
$File "mapbase\c_weapon_custom_hl2.cpp"
$File "mapbase\mapbase_autocubemap.cpp"
}
$Folder "HL2 DLL"

View File

@ -292,8 +292,11 @@ ClientModeShared::ClientModeShared()
m_pWeaponSelection = NULL;
m_nRootSize[ 0 ] = m_nRootSize[ 1 ] = -1;
#ifdef MAPBASE // From Alien Swarm SDK
m_pCurrentPostProcessController = NULL;
m_PostProcessLerpTimer.Invalidate();
m_pCurrentColorCorrection = NULL;
#endif
#if defined( REPLAY_ENABLED )
m_pReplayReminderPanel = NULL;
@ -635,6 +638,43 @@ void ClientModeShared::Update()
}
}
#ifdef MAPBASE // From Alien Swarm SDK
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void ClientModeShared::OnColorCorrectionWeightsReset( void )
{
C_ColorCorrection *pNewColorCorrection = NULL;
C_ColorCorrection *pOldColorCorrection = m_pCurrentColorCorrection;
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if ( pPlayer )
{
pNewColorCorrection = pPlayer->GetActiveColorCorrection();
}
if ( pNewColorCorrection != pOldColorCorrection )
{
if ( pOldColorCorrection )
{
pOldColorCorrection->EnableOnClient( false );
}
if ( pNewColorCorrection )
{
pNewColorCorrection->EnableOnClient( true, pOldColorCorrection == NULL );
}
m_pCurrentColorCorrection = pNewColorCorrection;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float ClientModeShared::GetColorCorrectionScale( void ) const
{
return 1.0f;
}
#endif
//-----------------------------------------------------------------------------
// This processes all input before SV Move messages are sent
//-----------------------------------------------------------------------------
@ -1259,7 +1299,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
}
}
if ( team == 0 && GetLocalTeam() > 0 )
if ( team == 0 && GetLocalTeam() )
{
bValidTeam = false;
}

View File

@ -91,6 +91,11 @@ public:
virtual void ProcessInput(bool bActive);
virtual bool CreateMove( float flInputSampleTime, CUserCmd *cmd );
virtual void Update();
#ifdef MAPBASE // From Alien Swarm SDK
virtual void OnColorCorrectionWeightsReset( void );
virtual float GetColorCorrectionScale( void ) const;
virtual void ClearCurrentColorCorrection() { m_pCurrentColorCorrection = NULL; }
#endif
// Input
virtual int KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
@ -165,12 +170,16 @@ private:
CBaseHudWeaponSelection *m_pWeaponSelection;
int m_nRootSize[2];
#ifdef MAPBASE // From Alien Swarm SDK
void UpdatePostProcessingEffects();
const C_PostProcessController* m_pCurrentPostProcessController;
PostProcessParameters_t m_CurrentPostProcessParameters;
PostProcessParameters_t m_LerpStartPostProcessParameters, m_LerpEndPostProcessParameters;
CountdownTimer m_PostProcessLerpTimer;
CHandle<C_ColorCorrection> m_pCurrentColorCorrection;
#endif
};
#endif // CLIENTMODE_NORMAL_H

View File

@ -125,6 +125,11 @@ ConVar r_threaded_client_shadow_manager( "r_threaded_client_shadow_manager", "1"
ConVar r_threaded_client_shadow_manager( "r_threaded_client_shadow_manager", "0" );
#endif
#ifdef MAPBASE
ConVarRef mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap" );
ConVarRef mat_depthbias_shadowmap( "mat_depthbias_shadowmap" );
#endif
#ifdef _WIN32
#pragma warning( disable: 4701 )
#endif
@ -1424,6 +1429,15 @@ bool CClientShadowMgr::Init()
materials->AddRestoreFunc( ShadowRestoreFunc );
#ifdef MAPBASE
// These need to be referenced here since the cvars don't exist in the initial declaration
mat_slopescaledepthbias_shadowmap = ConVarRef( "mat_slopescaledepthbias_shadowmap" );
mat_depthbias_shadowmap = ConVarRef( "mat_depthbias_shadowmap" );
mat_slopescaledepthbias_shadowmap.SetValue( "16" ); // Would do something like 2 here, but it causes citizens to look weird under flashlights
mat_depthbias_shadowmap.SetValue( "0.00005" );
#endif
return true;
}
@ -4470,13 +4484,18 @@ void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup )
}
CViewSetup shadowView;
#ifndef MAPBASE
shadowView.m_flAspectRatio = 1.0f;
#endif
shadowView.x = shadowView.y = 0;
shadowView.width = shadowDepthTexture->GetActualWidth();
shadowView.height = shadowDepthTexture->GetActualHeight();
#ifndef ASW_PROJECTED_TEXTURES
shadowView.m_bOrtho = false;
shadowView.m_bDoBloomAndToneMapping = false;
#ifdef MAPBASE
shadowView.m_flAspectRatio = (flashlightState.m_fHorizontalFOVDegrees / flashlightState.m_fVerticalFOVDegrees);
#endif // MAPBASE
#endif
// Copy flashlight parameters
@ -4484,6 +4503,10 @@ void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup )
if ( !flashlightState.m_bOrtho )
{
shadowView.m_bOrtho = false;
#ifdef MAPBASE
shadowView.m_flAspectRatio = (flashlightState.m_fHorizontalFOVDegrees / flashlightState.m_fVerticalFOVDegrees);
#endif // MAPBASE
}
else
{
@ -4492,6 +4515,10 @@ void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup )
shadowView.m_OrthoTop = flashlightState.m_fOrthoTop;
shadowView.m_OrthoRight = flashlightState.m_fOrthoRight;
shadowView.m_OrthoBottom = flashlightState.m_fOrthoBottom;
#ifdef MAPBASE
shadowView.m_flAspectRatio = 1.0f;
#endif
}
shadowView.m_bDoBloomAndToneMapping = false;

View File

@ -8,6 +8,12 @@
#include "cbase.h"
#include "tier0/vprof.h"
#include "colorcorrectionmgr.h"
#ifdef MAPBASE // From Alien Swarm SDK
#include "clientmode_shared.h" //"clientmode.h"
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
#endif
//------------------------------------------------------------------------------
@ -16,6 +22,13 @@
static CColorCorrectionMgr s_ColorCorrectionMgr;
CColorCorrectionMgr *g_pColorCorrectionMgr = &s_ColorCorrectionMgr;
#ifdef MAPBASE // From Alien Swarm SDK
static ConVar mat_colcorrection_editor( "mat_colcorrection_editor", "0" );
static CUtlVector<C_ColorCorrection *> g_ColorCorrectionList;
static CUtlVector<C_ColorCorrectionVolume *> g_ColorCorrectionVolumeList;
#endif
//------------------------------------------------------------------------------
// Constructor
@ -62,10 +75,89 @@ void CColorCorrectionMgr::RemoveColorCorrection( ClientCCHandle_t h )
}
}
#ifdef MAPBASE // From Alien Swarm SDK
ClientCCHandle_t CColorCorrectionMgr::AddColorCorrectionEntity( C_ColorCorrection *pEntity, const char *pName, const char *pFileName )
{
ClientCCHandle_t h = AddColorCorrection(pName, pFileName);
if ( h != INVALID_CLIENT_CCHANDLE )
{
Assert(g_ColorCorrectionList.Find(pEntity) == -1);
g_ColorCorrectionList.AddToTail(pEntity);
}
return h;
}
void CColorCorrectionMgr::RemoveColorCorrectionEntity( C_ColorCorrection *pEntity, ClientCCHandle_t h)
{
RemoveColorCorrection(h);
g_ColorCorrectionList.FindAndFastRemove(pEntity);
}
ClientCCHandle_t CColorCorrectionMgr::AddColorCorrectionVolume( C_ColorCorrectionVolume *pVolume, const char *pName, const char *pFileName )
{
ClientCCHandle_t h = AddColorCorrection(pName, pFileName);
if ( h != INVALID_CLIENT_CCHANDLE )
{
Assert(g_ColorCorrectionVolumeList.Find(pVolume) == -1);
g_ColorCorrectionVolumeList.AddToTail(pVolume);
}
return h;
}
void CColorCorrectionMgr::RemoveColorCorrectionVolume( C_ColorCorrectionVolume *pVolume, ClientCCHandle_t h)
{
RemoveColorCorrection(h);
g_ColorCorrectionVolumeList.FindAndFastRemove(pVolume);
}
#endif
//------------------------------------------------------------------------------
// Modify color correction weights
//------------------------------------------------------------------------------
#ifdef MAPBASE // From Alien Swarm SDK
void CColorCorrectionMgr::SetColorCorrectionWeight( ClientCCHandle_t h, float flWeight, bool bExclusive )
{
if ( h != INVALID_CLIENT_CCHANDLE )
{
SetWeightParams_t params = { h, flWeight, bExclusive };
m_colorCorrectionWeights.AddToTail( params );
if( bExclusive && m_bHaveExclusiveWeight && ( flWeight != 0.0f ) )
{
DevWarning( "Found multiple active color_correction entities with exclusive setting enabled. This is invalid.\n" );
}
if ( bExclusive )
{
m_bHaveExclusiveWeight = true;
m_flExclusiveWeight = flWeight;
}
}
}
void CColorCorrectionMgr::CommitColorCorrectionWeights()
{
CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
for ( int i = 0; i < m_colorCorrectionWeights.Count(); i++ )
{
ColorCorrectionHandle_t ccHandle = reinterpret_cast<ColorCorrectionHandle_t>( m_colorCorrectionWeights[i].handle );
float flWeight = m_colorCorrectionWeights[i].flWeight;
if ( !m_colorCorrectionWeights[i].bExclusive )
{
flWeight = (1.0f - m_flExclusiveWeight ) * m_colorCorrectionWeights[i].flWeight;
}
pRenderContext->SetLookupWeight( ccHandle, flWeight );
// FIXME: NOTE! This doesn't work if the same handle has
// its weight set twice with no intervening calls to ResetColorCorrectionWeights
// which, at the moment, is true
if ( flWeight != 0.0f )
{
++m_nActiveWeightCount;
}
}
m_colorCorrectionWeights.RemoveAll();
}
#else
void CColorCorrectionMgr::SetColorCorrectionWeight( ClientCCHandle_t h, float flWeight )
{
if ( h != INVALID_CLIENT_CCHANDLE )
@ -83,6 +175,7 @@ void CColorCorrectionMgr::SetColorCorrectionWeight( ClientCCHandle_t h, float fl
}
}
}
#endif
void CColorCorrectionMgr::ResetColorCorrectionWeights()
{
@ -93,6 +186,11 @@ void CColorCorrectionMgr::ResetColorCorrectionWeights()
CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
pRenderContext->ResetLookupWeights();
m_nActiveWeightCount = 0;
#ifdef MAPBASE // From Alien Swarm SDK
m_bHaveExclusiveWeight = false;
m_flExclusiveWeight = 0.0f;
m_colorCorrectionWeights.RemoveAll();
#endif
}
void CColorCorrectionMgr::SetResetable( ClientCCHandle_t h, bool bResetable )
@ -113,7 +211,34 @@ void CColorCorrectionMgr::SetResetable( ClientCCHandle_t h, bool bResetable )
//------------------------------------------------------------------------------
// Is color correction active?
//------------------------------------------------------------------------------
#ifdef MAPBASE // From Alien Swarm SDK
bool CColorCorrectionMgr::HasNonZeroColorCorrectionWeights() const
{
return ( m_nActiveWeightCount != 0 ) || mat_colcorrection_editor.GetBool();
}
void CColorCorrectionMgr::UpdateColorCorrection()
{
ResetColorCorrectionWeights();
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
IClientMode *pClientMode = GetClientModeNormal(); //GetClientMode();
Assert( pClientMode );
if ( !pPlayer || !pClientMode )
{
return;
}
pClientMode->OnColorCorrectionWeightsReset();
float ccScale = pClientMode->GetColorCorrectionScale();
UpdateColorCorrectionEntities( pPlayer, ccScale, g_ColorCorrectionList.Base(), g_ColorCorrectionList.Count() );
UpdateColorCorrectionVolumes( pPlayer, ccScale, g_ColorCorrectionVolumeList.Base(), g_ColorCorrectionVolumeList.Count() );
CommitColorCorrectionWeights();
}
#else
bool CColorCorrectionMgr::HasNonZeroColorCorrectionWeights() const
{
return ( m_nActiveWeightCount != 0 );
}
#endif

View File

@ -14,6 +14,10 @@
#include "igamesystem.h"
#ifdef MAPBASE // From Alien Swarm SDK
class C_ColorCorrection;
class C_ColorCorrectionVolume;
#endif
//------------------------------------------------------------------------------
// Purpose : Singleton manager for color correction on the client
@ -35,8 +39,21 @@ public:
ClientCCHandle_t AddColorCorrection( const char *pName, const char *pFileName = NULL );
void RemoveColorCorrection( ClientCCHandle_t );
#ifdef MAPBASE // From Alien Swarm SDK
ClientCCHandle_t AddColorCorrectionEntity( C_ColorCorrection *pEntity, const char *pName, const char *pFileName = NULL );
void RemoveColorCorrectionEntity( C_ColorCorrection *pEntity, ClientCCHandle_t );
ClientCCHandle_t AddColorCorrectionVolume( C_ColorCorrectionVolume *pVolume, const char *pName, const char *pFileName = NULL );
void RemoveColorCorrectionVolume( C_ColorCorrectionVolume *pVolume, ClientCCHandle_t );
#endif
// Modify color correction weights
#ifdef MAPBASE // From Alien Swarm SDK
void SetColorCorrectionWeight( ClientCCHandle_t h, float flWeight, bool bExclusive = false );
void UpdateColorCorrection();
#else
void SetColorCorrectionWeight( ClientCCHandle_t h, float flWeight );
#endif
void ResetColorCorrectionWeights();
void SetResetable( ClientCCHandle_t h, bool bResetable );
@ -45,8 +62,27 @@ public:
private:
int m_nActiveWeightCount;
#ifdef MAPBASE // From Alien Swarm SDK
bool m_bHaveExclusiveWeight;
float m_flExclusiveWeight;
struct SetWeightParams_t
{
ClientCCHandle_t handle;
float flWeight;
bool bExclusive;
};
CUtlVector< SetWeightParams_t > m_colorCorrectionWeights;
void CommitColorCorrectionWeights();
#endif
};
#ifdef MAPBASE // From Alien Swarm SDK
void UpdateColorCorrectionEntities( C_BasePlayer *pPlayer, float ccScale, C_ColorCorrection **pList, int listCount );
void UpdateColorCorrectionVolumes( C_BasePlayer *pPlayer, float ccScale, C_ColorCorrectionVolume **pList, int listCount );
#endif
//------------------------------------------------------------------------------
// Singleton access

View File

@ -0,0 +1,113 @@
//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============//
//
// Material proxy to stuff a convar into a material var.
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
// identifier was truncated to '255' characters in the debug information
//#pragma warning(disable: 4786)
#include "convar.h"
#include "materialsystem/imaterialproxy.h"
#include "materialsystem/imaterialvar.h"
//#include "imaterialproxydict.h"
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
class CConVarMaterialProxy: public IMaterialProxy
{
public:
CConVarMaterialProxy()
: m_pResult( NULL ),
m_conVarRef( "", true )
{
}
virtual ~CConVarMaterialProxy()
{
}
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
const char *pResult = pKeyValues->GetString( "resultVar" );
if ( !pResult )
return false;
bool found;
m_pResult = pMaterial->FindVar( pResult, &found );
if ( !found )
{
m_pResult = NULL;
return false;
}
/*
if ( !Q_stricmp( pResult, "$alpha" ) )
{
pMaterial->SetMaterialVarFlag( MATERIAL_VAR_ALPHA_MODIFIED_BY_PROXY, true );
}
*/
pResult = pKeyValues->GetString( "convar" );
if( !pResult )
{
return false;
}
m_conVarRef.Init( pResult, false );
if ( !m_conVarRef.IsValid() )
{
return false;
}
return true;
}
virtual void OnBind( void* )
{
switch( m_pResult->GetType() )
{
case MATERIAL_VAR_TYPE_VECTOR:
{
float f = m_conVarRef.GetFloat();
Vector4D vec( f, f, f, f );
m_pResult->SetVecValue( vec.Base(), m_pResult->VectorSize() );
}
break;
#ifdef MAPBASE
case MATERIAL_VAR_TYPE_STRING:
m_pResult->SetStringValue( m_conVarRef.GetString() );
break;
#endif
case MATERIAL_VAR_TYPE_INT:
m_pResult->SetIntValue( m_conVarRef.GetInt() );
break;
case MATERIAL_VAR_TYPE_FLOAT:
default:
m_pResult->SetFloatValue( m_conVarRef.GetFloat() );
break;
}
}
virtual IMaterial *GetMaterial()
{
return m_pResult->GetOwningMaterial();
}
virtual void Release()
{
}
protected:
IMaterialVar *m_pResult;
ConVarRef m_conVarRef;
};
EXPOSE_INTERFACE( CConVarMaterialProxy, IMaterialProxy, "ConVar" IMATERIAL_PROXY_INTERFACE_VERSION );

View File

@ -5,6 +5,10 @@
//=============================================================================
#include "cbase.h"
#ifdef MAPBASE
#include "proxyentity.h"
#include "materialsystem/imaterialvar.h"
#endif
class C_PropScalable : public C_BaseAnimating
{
@ -194,3 +198,56 @@ void C_PropScalable::GetRenderBounds( Vector &theMins, Vector &theMaxs )
Assert( theMins.IsValid() && theMaxs.IsValid() );
}
#ifdef MAPBASE
ConVar r_coreball_update_sphere_center( "r_coreball_update_sphere_center", "1", FCVAR_NONE, "Allows prop_coreball to update its center to the entity's origin" );
class CCoreBallUpdateMaterialProxy : public CEntityMaterialProxy
{
public:
CCoreBallUpdateMaterialProxy()
{
m_pMaterial = NULL;
m_pSphereCenter = NULL;
}
virtual ~CCoreBallUpdateMaterialProxy()
{
}
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
m_pMaterial = pMaterial;
bool found;
m_pSphereCenter = m_pMaterial->FindVar( "$spherecenter", &found );
if( !found )
{
m_pSphereCenter = NULL;
return false;
}
return true;
}
virtual void OnBind( C_BaseEntity *pC_BaseEntity )
{
if (r_coreball_update_sphere_center.GetBool())
{
const Vector &origin = pC_BaseEntity->GetAbsOrigin();
m_pSphereCenter->SetVecValue( origin.x, origin.y, origin.z );
}
else
{
// Just continuously bind the old hacked value (TODO: Optimize so it's not just assigning the same value constantly?)
m_pSphereCenter->SetVecValue( 2688.0, 12139.0, 5170.0 );
}
}
virtual IMaterial *GetMaterial()
{
return m_pMaterial;
}
protected:
IMaterial *m_pMaterial;
IMaterialVar *m_pSphereCenter;
};
EXPOSE_INTERFACE( CCoreBallUpdateMaterialProxy, IMaterialProxy, "CoreBallUpdate" IMATERIAL_PROXY_INTERFACE_VERSION );
#endif

View File

@ -462,3 +462,225 @@ void CEP2StunEffect::Render( int x, int y, int w, int h )
pRenderContext->MatrixMode( MATERIAL_PROJECTION );
pRenderContext->PopMatrix();
}
// ================================================================================================================
//
// Chromatic Aberration
//
// ================================================================================================================
#ifdef MAPBASE
ConVar r_chromatic_aberration_offset( "r_chromatic_aberration_offset", "8.0" );
ConVar r_chromatic_aberration_intensity( "r_chromatic_aberration_intensity", "0.2" );
ConVar r_chromatic_aberration_noise( "r_chromatic_aberration_noise", "4.0" );
ConVar r_chromatic_aberration_frame1_clr( "r_chromatic_aberration_frame1_clr", "1.0 0.0 0.0 1.0" );
ConVar r_chromatic_aberration_frame1_offset_x( "r_chromatic_aberration_frame1_offset_x", "1.0" );
ConVar r_chromatic_aberration_frame1_offset_y( "r_chromatic_aberration_frame1_offset_y", "4.0" );
ConVar r_chromatic_aberration_frame2_clr( "r_chromatic_aberration_frame2_clr", "0.0 1.0 0.0 1.0" );
ConVar r_chromatic_aberration_frame2_offset_x( "r_chromatic_aberration_frame2_offset_x", "-5.0" );
ConVar r_chromatic_aberration_frame2_offset_y( "r_chromatic_aberration_frame2_offset_y", "-1.0" );
ConVar r_chromatic_aberration_frame3_clr( "r_chromatic_aberration_frame3_clr", "0.0 0.0 1.0 1.0" );
ConVar r_chromatic_aberration_frame3_offset_x( "r_chromatic_aberration_frame3_offset_x", "3.0" );
ConVar r_chromatic_aberration_frame3_offset_y( "r_chromatic_aberration_frame3_offset_y", "-3.0" );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CChromaticAberrationEffect::Init( void )
{
m_flDuration = 0.0f;
m_flFinishTime = 0.0f;
m_bUpdateView = true;
KeyValues *pVMTKeyValues = new KeyValues( "UnlitGeneric" );
pVMTKeyValues->SetString( "$basetexture", STUN_TEXTURE );
m_EffectMaterial.Init( "__stuneffect", TEXTURE_GROUP_CLIENT_EFFECTS, pVMTKeyValues );
m_StunTexture.Init( STUN_TEXTURE, TEXTURE_GROUP_CLIENT_EFFECTS );
}
void CChromaticAberrationEffect::Shutdown( void )
{
m_EffectMaterial.Shutdown();
m_StunTexture.Shutdown();
}
//------------------------------------------------------------------------------
// Purpose: Pick up changes in our parameters
//------------------------------------------------------------------------------
void CChromaticAberrationEffect::SetParameters( KeyValues *params )
{
if( params->FindKey( "duration" ) )
{
m_flDuration = params->GetFloat( "duration" );
m_flFinishTime = gpGlobals->curtime + m_flDuration;
m_bUpdateView = true;
}
if( params->FindKey( "fadeout" ) )
{
m_bFadeOut = ( params->GetInt( "fadeout" ) == 1 );
}
if( params->FindKey( "stretch" ) )
{
m_bStretch = ( params->GetInt( "stretch" ) == 1 );
}
}
//-----------------------------------------------------------------------------
// Purpose: Render the effect
//-----------------------------------------------------------------------------
void CChromaticAberrationEffect::RenderColorFrame( CMatRenderContextPtr &pRenderContext, float flEffectPerc, int nColorMode, int x, int y, int w, int h )
{
// Change color
float flColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
float viewOffsX = flEffectPerc;
if (m_bStretch)
viewOffsX *= r_chromatic_aberration_offset.GetFloat() * 2;
else
viewOffsX *= r_chromatic_aberration_offset.GetFloat();
float viewOffsY = viewOffsX;
{
char szColor[16] = { 0 };
float flNoise = sin( gpGlobals->curtime * r_chromatic_aberration_noise.GetFloat() ) * flEffectPerc;
switch (nColorMode)
{
// Red
case 0:
Q_strncpy( szColor, r_chromatic_aberration_frame1_clr.GetString(), sizeof( szColor ) );
viewOffsX *= r_chromatic_aberration_frame1_offset_x.GetFloat();
viewOffsY *= r_chromatic_aberration_frame1_offset_y.GetFloat();
viewOffsX += flNoise;
viewOffsY += flNoise;
break;
// Green
case 1:
Q_strncpy( szColor, r_chromatic_aberration_frame2_clr.GetString(), sizeof( szColor ) );
viewOffsX *= r_chromatic_aberration_frame2_offset_x.GetFloat();
viewOffsY *= r_chromatic_aberration_frame2_offset_y.GetFloat();
viewOffsX += flNoise;
viewOffsY += flNoise;
break;
// Blue
case 2:
Q_strncpy( szColor, r_chromatic_aberration_frame3_clr.GetString(), sizeof( szColor ) );
viewOffsX *= r_chromatic_aberration_frame3_offset_x.GetFloat();
viewOffsY *= r_chromatic_aberration_frame3_offset_y.GetFloat();
viewOffsX += flNoise;
viewOffsY += flNoise;
break;
}
char *c = strtok( szColor, " " );
for (int i = 0; i < 4 && c != NULL; i++, c = strtok( NULL, " " ))
{
flColor[i] = atof( c );
}
}
if (flColor[3] == 0.0f || g_pMaterialSystemHardwareConfig->GetDXSupportLevel() < 80)
return;
m_EffectMaterial->ColorModulate( flColor[0], flColor[1], flColor[2] );
// Set alpha blend value
float flOverlayAlpha = clamp( r_chromatic_aberration_intensity.GetFloat() * flEffectPerc * flColor[3], 0.0f, 1.0f);
m_EffectMaterial->AlphaModulate( flOverlayAlpha );
// Draw full screen alpha-blended quad
if (m_bStretch)
{
float vX = x - (viewOffsX * 0.5f);
float vY = y - (viewOffsY * 0.5f);
pRenderContext->DrawScreenSpaceRectangle( m_EffectMaterial, vX, vY, w + viewOffsX, h + viewOffsY,
0, 0, (m_StunTexture->GetActualWidth()-1), (m_StunTexture->GetActualHeight()-1),
m_StunTexture->GetActualWidth(), m_StunTexture->GetActualHeight() );
}
else
{
float vX = x + viewOffsX;
float vY = y + viewOffsY;
pRenderContext->DrawScreenSpaceRectangle( m_EffectMaterial, 0, 0, w, h,
vX, vY, (m_StunTexture->GetActualWidth()-1)+vX, (m_StunTexture->GetActualHeight()-1)+vY,
m_StunTexture->GetActualWidth(), m_StunTexture->GetActualHeight() );
}
}
//-----------------------------------------------------------------------------
// Purpose: Render the effect
//-----------------------------------------------------------------------------
void CChromaticAberrationEffect::Render( int x, int y, int w, int h )
{
// Make sure we're ready to play this effect
if ( !IsEnabled() )
return;
if ( m_bFadeOut && m_flFinishTime < gpGlobals->curtime )
{
g_pScreenSpaceEffects->DisableScreenSpaceEffect( "mapbase_chromatic_aberration" );
return;
}
CMatRenderContextPtr pRenderContext( materials );
// Set ourselves to the proper rendermode
pRenderContext->MatrixMode( MATERIAL_VIEW );
pRenderContext->PushMatrix();
pRenderContext->LoadIdentity();
pRenderContext->MatrixMode( MATERIAL_PROJECTION );
pRenderContext->PushMatrix();
pRenderContext->LoadIdentity();
// Draw the texture if we're using it
if ( m_bUpdateView )
{
// Save off this pass
Rect_t srcRect;
srcRect.x = x;
srcRect.y = y;
srcRect.width = w;
srcRect.height = h;
pRenderContext->CopyRenderTargetToTextureEx( m_StunTexture, 0, &srcRect, NULL );
m_bUpdateView = false;
}
float flEffectPerc = SmoothCurve( clamp( ( m_flFinishTime - gpGlobals->curtime ) / m_flDuration, 0.0f, 1.0f ) );
if (!m_bFadeOut)
flEffectPerc = 1.0f - flEffectPerc;
RenderColorFrame( pRenderContext, flEffectPerc, 0, x, y, w, h );
RenderColorFrame( pRenderContext, flEffectPerc, 1, x, y, w, h );
RenderColorFrame( pRenderContext, flEffectPerc, 2, x, y, w, h );
// Save off this pass
Rect_t srcRect;
srcRect.x = x;
srcRect.y = y;
srcRect.width = w;
srcRect.height = h;
pRenderContext->CopyRenderTargetToTextureEx( m_StunTexture, 0, &srcRect, NULL );
// Restore our state
pRenderContext->MatrixMode( MATERIAL_VIEW );
pRenderContext->PopMatrix();
pRenderContext->MatrixMode( MATERIAL_PROJECTION );
pRenderContext->PopMatrix();
}
#endif

View File

@ -116,4 +116,38 @@ private:
ADD_SCREENSPACE_EFFECT( CEP2StunEffect, ep2_groggy );
#ifdef MAPBASE
class CChromaticAberrationEffect : public IScreenSpaceEffect
{
public:
CChromaticAberrationEffect( void ) :
m_flDuration( 0.0f ),
m_flFinishTime( 0.0f ),
m_bUpdateView( true ),
m_bEnabled( false ),
m_bFadeOut( false ) {}
virtual void Init( void );
virtual void Shutdown( void );
virtual void SetParameters( KeyValues *params );
virtual void Enable( bool bEnable ) { m_bEnabled = bEnable; };
virtual bool IsEnabled( ) { return m_bEnabled; }
virtual void RenderColorFrame( CMatRenderContextPtr &pRenderContext, float flEffectPerc, int nColorMode, int x, int y, int w, int h );
virtual void Render( int x, int y, int w, int h );
private:
CTextureReference m_StunTexture;
CMaterialReference m_EffectMaterial;
float m_flDuration;
float m_flFinishTime;
bool m_bUpdateView;
bool m_bStretch;
bool m_bFadeOut;
bool m_bEnabled;
};
ADD_SCREENSPACE_EFFECT( CChromaticAberrationEffect, mapbase_chromatic_aberration );
#endif
#endif // EPISODIC_SCREENSPACEEFFECTS_H

View File

@ -52,8 +52,8 @@ static ConVar r_flashlightladderdist( "r_flashlightladderdist", "40.0", FCVAR_CH
static ConVar mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap", "16", FCVAR_CHEAT );
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.0005", FCVAR_CHEAT );
#else
static ConVar mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap", "4", FCVAR_CHEAT );
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.00001", FCVAR_CHEAT );
extern ConVarRef mat_slopescaledepthbias_shadowmap;
extern ConVarRef mat_depthbias_shadowmap;
#endif
#ifdef MAPBASE
static ConVar r_flashlighttextureoverride( "r_flashlighttextureoverride", "", FCVAR_CHEAT );

View File

@ -25,6 +25,13 @@ extern ConVar r_drawmodeldecals;
ImpactSoundRouteFn g_pImpactSoundRouteFn = NULL;
#ifdef MAPBASE
ConVar g_ragdoll_steal_impacts_client( "g_ragdoll_steal_impacts_client", "1", FCVAR_NONE, "Allows clientside death ragdolls to \"steal\" impacts from their source entities. This fixes issues with NPCs dying before decals are applied." );
ConVar g_ragdoll_steal_impacts_server( "g_ragdoll_steal_impacts_server", "1", FCVAR_NONE, "Allows serverside death ragdolls to \"steal\" impacts from their source entities. This fixes issues with NPCs dying before decals are applied." );
ConVar g_ragdoll_client_impact_decals( "g_ragdoll_client_impact_decals", "1", FCVAR_NONE, "Applies decals to clientside ragdolls when they are hit." );
#endif
//==========================================================================================================================
// RAGDOLL ENUMERATOR
//==========================================================================================================================
@ -32,7 +39,11 @@ CRagdollEnumerator::CRagdollEnumerator( Ray_t& shot, int iDamageType )
{
m_rayShot = shot;
m_iDamageType = iDamageType;
#ifdef MAPBASE
m_pHitEnt = NULL;
#else
m_bHit = false;
#endif
}
IterationRetval_t CRagdollEnumerator::EnumElement( IHandleEntity *pHandleEntity )
@ -57,7 +68,11 @@ IterationRetval_t CRagdollEnumerator::EnumElement( IHandleEntity *pHandleEntity
if ( tr.fraction < 1.0 )
{
pModel->ImpactTrace( &tr, m_iDamageType, NULL );
#ifdef MAPBASE
m_pHitEnt = pModel;
#else
m_bHit = true;
#endif
//FIXME: Yes? No?
return ITERATION_STOP;
@ -84,6 +99,22 @@ bool FX_AffectRagdolls( Vector vecOrigin, Vector vecStart, int iDamageType )
return ragdollEnum.Hit();
}
#ifdef MAPBASE
C_BaseAnimating *FX_AffectRagdolls_GetHit( Vector vecOrigin, Vector vecStart, int iDamageType )
{
// don't do this when lots of ragdolls are simulating
if ( s_RagdollLRU.CountRagdolls(true) > 1 )
return NULL;
Ray_t shotRay;
shotRay.Init( vecStart, vecOrigin );
CRagdollEnumerator ragdollEnum( shotRay, iDamageType );
partition->EnumerateElementsAlongRay( PARTITION_CLIENT_RESPONSIVE_EDICTS, shotRay, false, &ragdollEnum );
return ragdollEnum.GetHit();
}
#endif
//-----------------------------------------------------------------------------
// Purpose:
// Input : &data -
@ -104,6 +135,22 @@ bool Impact( Vector &vecOrigin, Vector &vecStart, int iMaterial, int iDamageType
Assert ( pEntity );
#ifdef MAPBASE
// If the entity already has a ragdoll that was created on the current tick, use that ragdoll instead.
// This allows the killing damage's decals to show up on the ragdoll.
if (C_BaseAnimating *pAnimating = pEntity->GetBaseAnimating())
{
if (pAnimating->m_pClientsideRagdoll && WasRagdollCreatedOnCurrentTick( pAnimating->m_pClientsideRagdoll ) && g_ragdoll_steal_impacts_client.GetBool())
{
pEntity = pAnimating->m_pClientsideRagdoll;
}
else if (pAnimating->m_pServerRagdoll && WasRagdollCreatedOnCurrentTick( pAnimating->m_pServerRagdoll ) && g_ragdoll_steal_impacts_server.GetBool())
{
pEntity = pAnimating->m_pServerRagdoll;
}
}
#endif
// Clear out the trace
memset( &tr, 0, sizeof(trace_t));
tr.fraction = 1.0f;
@ -118,10 +165,49 @@ bool Impact( Vector &vecOrigin, Vector &vecStart, int iMaterial, int iDamageType
bool bHitRagdoll = false;
#ifdef MAPBASE
if ( !pEntity->IsClientCreated() )
{
C_BaseAnimating *pRagdoll = FX_AffectRagdolls_GetHit( vecOrigin, vecStart, iDamageType );
if (pRagdoll)
{
bHitRagdoll = true;
if (g_ragdoll_client_impact_decals.GetBool() && pRagdoll->IsRagdoll())
{
pEntity = pRagdoll;
// HACKHACK: Get the ragdoll's nearest bone for its material
int iNearestMaterial = 0;
float flNearestDistSqr = FLT_MAX;
IPhysicsObject *pList[VPHYSICS_MAX_OBJECT_LIST_COUNT];
int count = pEntity->VPhysicsGetObjectList( pList, ARRAYSIZE(pList) );
for ( int i = 0; i < count; i++ )
{
Vector vecPosition;
QAngle angAngles;
pList[i]->GetPosition( &vecPosition, &angAngles );
float flDistSqr = (vecStart - vecPosition).LengthSqr();
if (flDistSqr < flNearestDistSqr)
{
iNearestMaterial = pList[i]->GetMaterialIndex();
flNearestDistSqr = flDistSqr;
}
}
// Get the material from the surfaceprop
surfacedata_t *psurfaceData = physprops->GetSurfaceData( iNearestMaterial );
iMaterial = psurfaceData->game.material;
}
}
}
#else
if ( !pEntity->IsClientCreated() )
{
bHitRagdoll = FX_AffectRagdolls( vecOrigin, vecStart, iDamageType );
}
#endif
if ( (nFlags & IMPACT_NODECAL) == 0 )
{

View File

@ -58,12 +58,21 @@ public:
// Actual work code
virtual IterationRetval_t EnumElement( IHandleEntity *pHandleEntity );
#ifdef MAPBASE
bool Hit( void ) const { return m_pHitEnt != NULL; }
C_BaseAnimating *GetHit( void ) { return m_pHitEnt; }
#else
bool Hit( void ) const { return m_bHit; }
#endif
private:
Ray_t m_rayShot;
int m_iDamageType;
#ifdef MAPBASE
C_BaseAnimating *m_pHitEnt;
#else
bool m_bHit;
#endif
};
#endif // FX_IMPACT_H

View File

@ -146,6 +146,32 @@ bool CBaseViewport::LoadHudAnimations( void )
return true;
}
#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Purpose: Reloads HUD animations after loading a map-specific HUD animations file.
//-----------------------------------------------------------------------------
void CBaseViewport::ReloadHudAnimations( void )
{
// Force a reload
if ( LoadHudAnimations() == false )
{
// Fall back to just the main
if ( m_pAnimController->SetScriptFile( GetVPanel(), "scripts/HudAnimations.txt", true ) == false )
{
Assert(0);
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Loads a map-specific HUD animations file.
//-----------------------------------------------------------------------------
bool CBaseViewport::LoadCustomHudAnimations( const char *pszFile )
{
return m_pAnimController->SetScriptFile( GetVPanel(), pszFile, true );
}
#endif
//================================================================
CBaseViewport::CBaseViewport() : vgui::EditablePanel( NULL, "CBaseViewport")
{

View File

@ -73,6 +73,10 @@ public:
public: // IGameEventListener:
virtual void FireGameEvent( IGameEvent * event);
#ifdef MAPBASE
bool LoadCustomHudAnimations( const char *pszFile );
void ReloadHudAnimations( void );
#endif
protected:

View File

@ -150,6 +150,10 @@ private:
static const int ENTRY_IN_USE = -2;
};
#ifdef MAPBASE_VSCRIPT
// For unregistration boundary check
public:
#endif
CUtlVector< GlowObjectDefinition_t > m_GlowObjectDefinitions;
int m_nFirstFreeSlot;
};

View File

@ -31,6 +31,9 @@ ConVar cl_npc_speedmod_outtime( "cl_npc_speedmod_outtime", "1.5", FCVAR_CLIENTDL
IMPLEMENT_CLIENTCLASS_DT(C_BaseHLPlayer, DT_HL2_Player, CHL2_Player)
RecvPropDataTable( RECVINFO_DT(m_HL2Local),0, &REFERENCE_RECV_TABLE(DT_HL2Local) ),
RecvPropBool( RECVINFO( m_fIsSprinting ) ),
#ifdef SP_ANIM_STATE
RecvPropFloat( RECVINFO( m_flAnimRenderYaw ) ),
#endif
END_RECV_TABLE()
BEGIN_PREDICTION_DATA( C_BaseHLPlayer )
@ -90,6 +93,13 @@ void C_BaseHLPlayer::OnDataChanged( DataUpdateType_t updateType )
SetNextClientThink( CLIENT_THINK_ALWAYS );
}
#ifdef SP_ANIM_STATE
if (m_flAnimRenderYaw != FLT_MAX)
{
m_angAnimRender = QAngle( 0, m_flAnimRenderYaw, 0 );
}
#endif
BaseClass::OnDataChanged( updateType );
}
@ -657,3 +667,21 @@ void C_BaseHLPlayer::BuildTransformations( CStudioHdr *hdr, Vector *pos, Quatern
BuildFirstPersonMeathookTransformations( hdr, pos, q, cameraTransform, boneMask, boneComputed, "ValveBiped.Bip01_Head1" );
}
#ifdef SP_ANIM_STATE
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
const QAngle& C_BaseHLPlayer::GetRenderAngles( void )
{
if ( m_flAnimRenderYaw != FLT_MAX )
{
return m_angAnimRender;
}
else
{
return BaseClass::GetRenderAngles();
}
}
#endif

View File

@ -15,6 +15,10 @@
#include "c_baseplayer.h"
#include "c_hl2_playerlocaldata.h"
#if !defined( HL2MP ) && defined ( MAPBASE )
#include "mapbase/singleplayer_animstate.h"
#endif
class C_BaseHLPlayer : public C_BasePlayer
{
public:
@ -58,6 +62,10 @@ public:
bool IsWeaponLowered( void ) { return m_HL2Local.m_bWeaponLowered; }
#ifdef SP_ANIM_STATE
virtual const QAngle& GetRenderAngles( void );
#endif
public:
C_HL2PlayerLocalData m_HL2Local;
@ -79,6 +87,12 @@ private:
float m_flSpeedMod;
float m_flExitSpeedMod;
#ifdef SP_ANIM_STATE
// At the moment, we network the render angles since almost none of the player anim stuff is done on the client in SP.
// If any of this is ever adapted for MP, this method should be replaced with replicating/moving the anim state to the client.
float m_flAnimRenderYaw;
QAngle m_angAnimRender;
#endif
friend class CHL2GameMovement;
};

View File

@ -32,6 +32,15 @@ struct creditname_t
float flTimeAdd;
float flTimeStart;
int iSlot;
#ifdef MAPBASE
// New credits stuff
CCopyableUtlVector<int> cColorOverride;
// Images
int iImageID = -1;
float flImageScale = 1.0f;
#endif
};
#define CREDITS_FILE "scripts/credits.txt"
@ -47,6 +56,9 @@ enum
#define CREDITS_LOGO 1
#define CREDITS_INTRO 2
#define CREDITS_OUTRO 3
#ifdef MAPBASE
#define CREDITS_PRECACHE 4
#endif
bool g_bRollingCredits = false;
@ -93,15 +105,27 @@ private:
void DrawOutroCreditsName( void );
void DrawIntroCreditsName( void );
void DrawLogo( void );
#ifdef MAPBASE
void DrawOutroCreditFont( const char *pCreditName, float flYPos, vgui::HFont hTFont, const Color &cColor, int iScreenWidth, int iDivisor = 2 );
void DrawOutroCreditTexture( int iImageID, float flYPos, float flImageScale, const Color &cColor, int iScreenWidth, int iDivisor = 2 );
#endif
void PrepareLogo( float flTime );
void PrepareOutroCredits( void );
void PrepareIntroCredits( void );
#ifdef MAPBASE
void PrecacheCredits();
#endif
float FadeBlend( float fadein, float fadeout, float hold, float localTime );
void PrepareLine( vgui::HFont hFont, char const *pchLine );
#ifdef MAPBASE
int GetOrAllocateImageID( const char *szFileName );
#endif
CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "Default" );
CPanelAnimationVar( Color, m_TextColor, "TextColor", "FgColor" );
@ -111,6 +135,9 @@ private:
float m_flSeparation;
#ifdef MAPBASE
int m_iEndLines;
float m_flEndLinesFadeHoldTime;
bool m_bAllowColumns;
CUtlDict<int, int> m_ImageDict;
#endif
float m_flFadeTime;
bool m_bLastOneInPlace;
@ -141,6 +168,9 @@ private:
char m_szCreditsFile[MAX_PATH];
char m_szLogoFont[64];
char m_szLogo2Font[64];
Color m_cLogoColor;
Color m_cLogo2Color;
#endif
};
@ -202,6 +232,20 @@ void CHudCredits::Clear( void )
m_bLastOneInPlace = false;
m_Alpha = m_TextColor[3];
m_iLogoState = LOGO_FADEOFF;
#ifdef MAPBASE
if ( surface() )
{
for (int i = m_ImageDict.Count()-1; i >= 0; i--)
{
if (m_ImageDict[i] != -1)
{
surface()->DestroyTextureID( m_ImageDict[i] );
m_ImageDict.RemoveAt( i );
}
}
}
#endif
}
//-----------------------------------------------------------------------------
@ -229,7 +273,11 @@ void CHudCredits::ReadNames( KeyValues *pKeyValue )
{
creditname_t Credits;
V_strcpy_safe( Credits.szCreditName, pKVNames->GetName() );
#ifdef MAPBASE
V_strcpy_safe( Credits.szFontName, pKVNames->GetString( (const char *)NULL, "Default" ) );
#else
V_strcpy_safe( Credits.szFontName, pKeyValue->GetString( Credits.szCreditName, "Default" ) );
#endif
m_CreditsList.AddToTail( Credits );
pKVNames = pKVNames->GetNextKey();
@ -248,6 +296,8 @@ void CHudCredits::ReadParams( KeyValues *pKeyValue )
m_flSeparation = pKeyValue->GetFloat( "separation", 5 );
#ifdef MAPBASE
m_iEndLines = pKeyValue->GetInt( "endlines", 1 );
m_flEndLinesFadeHoldTime = pKeyValue->GetFloat( "endlines_fadeholdtime", ( IsConsole() ? 2.0f : 10.0f ) ); // "360 certification requires that we not hold a static image too long."
m_bAllowColumns = pKeyValue->GetBool( "allow_columns", false );
#endif
m_flFadeInTime = pKeyValue->GetFloat( "fadeintime", 1 );
@ -268,6 +318,10 @@ void CHudCredits::ReadParams( KeyValues *pKeyValue )
#ifdef MAPBASE
Q_strncpy( m_szLogoFont, pKeyValue->GetString( "logofont", "" ), sizeof( m_szLogoFont ) );
Q_strncpy( m_szLogo2Font, pKeyValue->GetString( "logo2font", "" ), sizeof( m_szLogo2Font ) );
m_cLogoColor = pKeyValue->GetColor( "logocolor" );
m_cLogo2Color = pKeyValue->GetColor( "logo2color" );
#endif
}
@ -300,10 +354,46 @@ void CHudCredits::DrawOutroCreditsName( void )
if ( pCredit == NULL )
continue;
#ifdef MAPBASE
vgui::HScheme scheme = GetScheme();
#else
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName, true );
#endif
vgui::HFont m_hTFont = INVALID_FONT;
int iFontTall = surface()->GetFontTall ( m_hTFont );
int iFontTall = 1;
#ifdef MAPBASE
if (pCredit->iImageID != -1)
{
// Get the size of the tallest image if there's multiple
int iFontWide;
if (m_bAllowColumns && V_strstr( pCredit->szCreditName, "\t" ))
{
CUtlStringList outStrings;
V_SplitString( pCredit->szCreditName, "\t", outStrings );
FOR_EACH_VEC( outStrings, i )
{
int iTempTall;
surface()->DrawGetTextureSize( GetOrAllocateImageID( outStrings[i] ), iFontWide, iTempTall );
if (iTempTall > iFontTall)
iFontTall = iTempTall;
}
outStrings.PurgeAndDeleteElements();
}
else
{
surface()->DrawGetTextureSize( GetOrAllocateImageID( pCredit->szCreditName ), iFontWide, iFontTall );
}
iFontTall = ((float)iFontTall * pCredit->flImageScale);
}
else
#endif
{
m_hTFont = vgui::scheme()->GetIScheme( scheme )->GetFont( pCredit->szFontName, true );
iFontTall = surface()->GetFontTall( m_hTFont );
}
if ( pCredit->flYPos < -iFontTall || pCredit->flYPos > iTall )
{
@ -317,6 +407,9 @@ void CHudCredits::DrawOutroCreditsName( void )
Color cColor = m_TextColor;
#ifdef MAPBASE
if (pCredit->cColorOverride.Count() > 0)
cColor.SetRawColor( pCredit->cColorOverride[0] );
// Some lines should stick around and fade out
if ( i >= m_CreditsList.Count()-m_iEndLines )
#else
@ -333,8 +426,12 @@ void CHudCredits::DrawOutroCreditsName( void )
{
m_bLastOneInPlace = true;
#ifdef MAPBASE
m_flFadeTime = gpGlobals->curtime + m_flEndLinesFadeHoldTime;
#else
// 360 certification requires that we not hold a static image too long.
m_flFadeTime = gpGlobals->curtime + ( IsConsole() ? 2.0f : 10.0f );
#endif
}
}
else
@ -364,6 +461,62 @@ void CHudCredits::DrawOutroCreditsName( void )
if ( pCredit->bActive == false )
continue;
#ifdef MAPBASE
// Credits separated by tabs should appear divided
if (m_bAllowColumns && V_strstr( pCredit->szCreditName, "\t" ))
{
CUtlStringList outStrings;
V_SplitString( pCredit->szCreditName, "\t", outStrings );
int iDivisor = 1 + outStrings.Count();
if (pCredit->iImageID != -1)
{
FOR_EACH_VEC( outStrings, i )
{
if (i < pCredit->cColorOverride.Count())
{
// Change color to this particular column's color
cColor.SetRawColor( pCredit->cColorOverride[i] );
}
int iImageID = GetOrAllocateImageID( outStrings[i] );
// Center the image if needed
int iImageWide, iImageTall = 1;
surface()->DrawGetTextureSize( iImageID, iImageWide, iImageTall );
if (iImageTall < iFontTall)
{
DrawOutroCreditTexture( iImageID, pCredit->flYPos + ((iFontTall * 0.5f) - (iImageTall * 0.5f)), pCredit->flImageScale, cColor, iWidth*(i + 1), iDivisor );
}
else
{
DrawOutroCreditTexture( iImageID, pCredit->flYPos, pCredit->flImageScale, cColor, iWidth*(i + 1), iDivisor );
}
}
}
else
{
FOR_EACH_VEC( outStrings, i )
{
if (i < pCredit->cColorOverride.Count())
{
// Change color to this particular column's color
cColor.SetRawColor( pCredit->cColorOverride[i] );
}
DrawOutroCreditFont( outStrings[i], pCredit->flYPos, m_hTFont, cColor, iWidth*(i + 1), iDivisor );
}
}
outStrings.PurgeAndDeleteElements();
}
else if (pCredit->iImageID != -1)
{
DrawOutroCreditTexture( pCredit->iImageID, pCredit->flYPos, pCredit->flImageScale, cColor, iWidth, 2 );
}
else
{
DrawOutroCreditFont( pCredit->szCreditName, pCredit->flYPos, m_hTFont, cColor, iWidth, 2 );
}
#else
surface()->DrawSetTextFont( m_hTFont );
surface()->DrawSetTextColor( cColor[0], cColor[1], cColor[2], cColor[3] );
@ -382,9 +535,56 @@ void CHudCredits::DrawOutroCreditsName( void )
surface()->DrawSetTextPos( ( iWidth / 2 ) - ( iStringWidth / 2 ), pCredit->flYPos );
surface()->DrawUnicodeString( unicode );
#endif
}
}
#ifdef MAPBASE
void CHudCredits::DrawOutroCreditFont( const char *pCreditName, float flYPos, vgui::HFont hTFont, const Color &cColor, int iScreenWidth, int iDivisor )
{
surface()->DrawSetTextFont( hTFont );
surface()->DrawSetTextColor( cColor[0], cColor[1], cColor[2], cColor[3] );
wchar_t unicode[256];
if ( pCreditName[0] == '#' )
{
g_pVGuiLocalize->ConstructString( unicode, sizeof(unicode), g_pVGuiLocalize->Find(pCreditName), 0 );
}
else
{
g_pVGuiLocalize->ConvertANSIToUnicode( pCreditName, unicode, sizeof( unicode ) );
}
int iStringWidth = GetStringPixelWidth( unicode, hTFont );
// ((iScreenWidth*iMultiplier) / iDivisor)
// When needed, just multiply iScreenWidth before sending to the function
surface()->DrawSetTextPos( (iScreenWidth / iDivisor) - (iStringWidth / 2), flYPos );
surface()->DrawUnicodeString( unicode );
}
void CHudCredits::DrawOutroCreditTexture( int iImageID, float flYPos, float flImageScale, const Color &cColor, int iScreenWidth, int iDivisor )
{
int iImageWide, iImageTall;
surface()->DrawGetTextureSize( iImageID, iImageWide, iImageTall );
// Scale for resolution
flImageScale *= ((float)GetTall() / 900.0f);
iImageWide = ((float)(iImageWide) * flImageScale);
iImageTall = ((float)(iImageTall) * flImageScale);
iImageWide /= 2;
//iImageTall /= 2;
iScreenWidth /= iDivisor;
surface()->DrawSetColor( cColor );
surface()->DrawSetTexture( iImageID );
surface()->DrawTexturedRect( iScreenWidth - iImageWide, flYPos, iScreenWidth + iImageWide, flYPos + iImageTall );
}
#endif
void CHudCredits::DrawLogo( void )
{
if( m_iLogoState == LOGO_FADEOFF )
@ -464,7 +664,11 @@ void CHudCredits::DrawLogo( void )
Q_snprintf( szLogoFont, sizeof( szLogoFont ), "WeaponIcons" );
}
#ifdef MAPBASE
vgui::HScheme scheme = GetScheme();
#else
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
#endif
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( szLogoFont );
int iFontTall = surface()->GetFontTall ( m_hTFont );
@ -472,6 +676,11 @@ void CHudCredits::DrawLogo( void )
Color cColor = m_TextColor;
cColor[3] = m_Alpha;
#ifdef MAPBASE
if (m_cLogoColor.a() > 0)
cColor = m_cLogoColor;
#endif
surface()->DrawSetTextFont( m_hTFont );
surface()->DrawSetTextColor( cColor[0], cColor[1], cColor[2], cColor[3] );
@ -485,6 +694,19 @@ void CHudCredits::DrawLogo( void )
if ( Q_strlen( m_szLogo2 ) > 0 )
{
#ifdef MAPBASE
if (m_szLogo2Font[0] != '\0')
{
m_hTFont = vgui::scheme()->GetIScheme( scheme )->GetFont( m_szLogo2Font );
iFontTall = surface()->GetFontTall( m_hTFont );
surface()->DrawSetTextFont( m_hTFont );
}
if (m_cLogo2Color.a() > 0)
{
surface()->DrawSetTextColor( m_cLogo2Color[0], m_cLogo2Color[1], m_cLogo2Color[2], m_cLogo2Color[3] );
}
#endif
g_pVGuiLocalize->ConvertANSIToUnicode( m_szLogo2, unicode, sizeof( unicode ) );
iStringWidth = GetStringPixelWidth( unicode, m_hTFont );
@ -545,13 +767,25 @@ void CHudCredits::DrawIntroCreditsName( void )
if ( pCredit->bActive == false )
continue;
#ifdef MAPBASE
vgui::HScheme scheme = GetScheme();
#else
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
#endif
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName );
float localTime = gpGlobals->curtime - pCredit->flTimeStart;
surface()->DrawSetTextFont( m_hTFont );
#ifdef MAPBASE
Color cColor = m_cColor;
if (pCredit->cColorOverride.Count() > 0)
cColor.SetRawColor( pCredit->cColorOverride[0] );
surface()->DrawSetTextColor( cColor[0], cColor[1], cColor[2], FadeBlend( m_flFadeInTime, m_flFadeOutTime, m_flFadeHoldTime + pCredit->flTimeAdd, localTime ) * cColor[3] );
#else
surface()->DrawSetTextColor( m_cColor[0], m_cColor[1], m_cColor[2], FadeBlend( m_flFadeInTime, m_flFadeOutTime, m_flFadeHoldTime + pCredit->flTimeAdd, localTime ) * m_cColor[3] );
#endif
wchar_t unicode[256];
g_pVGuiLocalize->ConvertANSIToUnicode( pCredit->szCreditName, unicode, sizeof( unicode ) );
@ -692,8 +926,135 @@ void CHudCredits::PrepareOutroCredits( void )
if ( pCredit == NULL )
continue;
#ifdef MAPBASE
vgui::HScheme scheme = GetScheme();
#else
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName, true );
#endif
#ifdef MAPBASE
if (pCredit->szFontName[0] == '$')
{
if (V_strncmp( pCredit->szFontName + 1, "Image", 5 ) == 0)
{
if (pCredit->szFontName[6] == ';')
{
CUtlStringList outStrings;
V_SplitString( pCredit->szFontName, ";", outStrings );
FOR_EACH_VEC( outStrings, i )
{
switch (i)
{
// Get scale
case 1:
pCredit->flImageScale = atof( outStrings[i] );
break;
// Get color
case 2:
char *pToken = strtok( outStrings[i], "," );
if (pToken)
{
// Multiple colors for multiple columns
while (pToken != NULL)
{
int tmp[4];
UTIL_StringToIntArray( tmp, 4, pToken );
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
pToken = strtok( NULL, "," );
}
}
else
{
int tmp[4];
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
}
break;
}
}
outStrings.PurgeAndDeleteElements();
}
// Get the size of the tallest image if there's multiple
int iFontWide, iFontTall = 1;
if (m_bAllowColumns && V_strstr( pCredit->szCreditName, "\t" ))
{
CUtlStringList outStrings;
V_SplitString( pCredit->szCreditName, "\t", outStrings );
FOR_EACH_VEC( outStrings, i )
{
pCredit->iImageID = GetOrAllocateImageID( outStrings[i] );
int iTempTall;
surface()->DrawGetTextureSize( pCredit->iImageID, iFontWide, iTempTall );
if (iTempTall > iFontTall)
iFontTall = iTempTall;
}
outStrings.PurgeAndDeleteElements();
}
else
{
pCredit->iImageID = GetOrAllocateImageID( pCredit->szCreditName );
surface()->DrawGetTextureSize( pCredit->iImageID, iFontWide, iFontTall );
}
pCredit->flYPos = iHeight;
pCredit->bActive = false;
iHeight += ((float)iFontTall * pCredit->flImageScale * ((float)GetTall() / 900.0f)) + m_flSeparation;
//Msg( "'%s' is image type (image scale is %f)\n", pCredit->szCreditName, pCredit->flImageScale );
}
else
{
//Msg( "'%s' is not an image type\n", pCredit->szFontName + 1 );
}
}
else
#endif
{
#ifdef MAPBASE
if (V_strstr( pCredit->szFontName, ";" ))
{
CUtlStringList outStrings;
V_SplitString( pCredit->szFontName, ";", outStrings );
FOR_EACH_VEC( outStrings, i )
{
switch (i)
{
// Get color
case 1:
char *pToken = strtok( outStrings[i], "," );
if (pToken)
{
// Multiple colors for multiple columns
while (pToken != NULL)
{
int tmp[4];
UTIL_StringToIntArray( tmp, 4, pToken );
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
pToken = strtok( NULL, "," );
}
}
else
{
int tmp[4];
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
}
break;
}
}
Q_strncpy( pCredit->szFontName, outStrings[0], sizeof( pCredit->szFontName ) );
outStrings.PurgeAndDeleteElements();
}
#endif
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme( scheme )->GetFont( pCredit->szFontName, true );
pCredit->flYPos = iHeight;
pCredit->bActive = false;
@ -702,6 +1063,17 @@ void CHudCredits::PrepareOutroCredits( void )
PrepareLine( m_hTFont, pCredit->szCreditName );
}
}
#ifdef MAPBASE
// Check if the last line has a color override. If it does, use that as the alpha for the fadeout
if (m_CreditsList.Tail().cColorOverride.Count() > 0)
{
Color clr;
clr.SetRawColor( m_CreditsList.Tail().cColorOverride[0] );
m_Alpha = clr.a();
}
#endif
SetActive( true );
@ -721,7 +1093,35 @@ void CHudCredits::PrepareIntroCredits( void )
if ( pCredit == NULL )
continue;
#ifdef MAPBASE
if (V_strstr( pCredit->szFontName, ";" ))
{
CUtlStringList outStrings;
V_SplitString( pCredit->szFontName, ";", outStrings );
FOR_EACH_VEC( outStrings, i )
{
switch (i)
{
// Get color
case 1:
// TODO: Columns?
int tmp[4];
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
break;
}
}
Q_strncpy( pCredit->szFontName, outStrings[0], sizeof( pCredit->szFontName ) );
outStrings.PurgeAndDeleteElements();
}
#endif
#ifdef MAPBASE
vgui::HScheme scheme = GetScheme();
#else
vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
#endif
vgui::HFont m_hTFont = vgui::scheme()->GetIScheme(scheme)->GetFont( pCredit->szFontName );
pCredit->flYPos = m_flY + ( iSlot * surface()->GetFontTall ( m_hTFont ) );
@ -749,6 +1149,64 @@ void CHudCredits::PrepareIntroCredits( void )
SetActive( true );
}
#ifdef MAPBASE
void CHudCredits::PrecacheCredits()
{
PrepareCredits( "OutroCreditsNames" );
if ( m_CreditsList.Count() == 0 )
return;
for ( int i = 0; i < m_CreditsList.Count(); i++ )
{
creditname_t *pCredit = &m_CreditsList[i];
if ( pCredit == NULL )
continue;
if (pCredit->szFontName[0] == '$')
{
if (V_strncmp( pCredit->szFontName + 1, "Image", 5 ) == 0)
{
if (m_bAllowColumns && V_strstr( pCredit->szCreditName, "\t" ))
{
CUtlStringList outStrings;
V_SplitString( pCredit->szCreditName, "\t", outStrings );
FOR_EACH_VEC( outStrings, i )
{
GetOrAllocateImageID( outStrings[i] );
}
outStrings.PurgeAndDeleteElements();
}
else
{
GetOrAllocateImageID( pCredit->szCreditName );
}
}
else
{
//Msg( "'%s' is not an image type\n", pCredit->szFontName + 1 );
}
}
}
m_CreditsList.RemoveAll();
}
int CHudCredits::GetOrAllocateImageID( const char *szFileName )
{
int iIndex = m_ImageDict.Find( szFileName );
if (iIndex == m_ImageDict.InvalidIndex())
{
iIndex = surface()->CreateNewTextureID();
m_ImageDict.Insert( szFileName, iIndex );
surface()->DrawSetTextureFile( iIndex, szFileName, true, false );
return iIndex;
}
return m_ImageDict[iIndex];
}
#endif
void CHudCredits::MsgFunc_CreditsMsg( bf_read &msg )
{
m_iCreditsType = msg.ReadByte();
@ -777,6 +1235,13 @@ void CHudCredits::MsgFunc_CreditsMsg( bf_read &msg )
PrepareOutroCredits();
break;
}
#ifdef MAPBASE
case CREDITS_PRECACHE:
{
PrecacheCredits();
break;
}
#endif
}
}

View File

@ -644,6 +644,15 @@ void CHudWeaponSelection::Paint()
// This is a bit of a misnomer... we really are asking "Is this the selected slot"?
selectedWeapon = true;
}
#ifdef MAPBASE
else if (!hud_showemptyweaponslots.GetBool() && !pWeapon)
{
// Revert the offset
xPos -= ( m_flMediumBoxWide + 5 ) * xModifiers[ i ];
yPos -= ( m_flMediumBoxTall + 5 ) * yModifiers[ i ];
continue;
}
#endif
// Draw the box with the appropriate icon
DrawLargeWeaponBox( pWeapon,
@ -1375,6 +1384,23 @@ void CHudWeaponSelection::PlusTypeFastWeaponSwitch( int iWeaponSlot )
// Changing vertical/horizontal direction. Reset the selected box position to zero.
m_iSelectedBoxPosition = 0;
m_iSelectedSlot = iWeaponSlot;
#ifdef MAPBASE
if (!hud_showemptyweaponslots.GetBool())
{
// Skip empty slots
int i = 0;
while ( i < MAX_WEAPON_POSITIONS )
{
C_BaseCombatWeapon *pWeapon = GetWeaponInSlot( iWeaponSlot, i );
if ( pWeapon )
break;
i++;
}
m_iSelectedBoxPosition = i;
}
#endif
}
else
{
@ -1385,6 +1411,27 @@ void CHudWeaponSelection::PlusTypeFastWeaponSwitch( int iWeaponSlot )
// Decrementing within the slot. If we're at the zero position in this slot,
// jump to the zero position of the opposite slot. This also counts as our increment.
increment = -1;
#ifdef MAPBASE
if (!hud_showemptyweaponslots.GetBool())
{
// Skip empty slots
int iZeroPos = 0;
while ( iZeroPos < MAX_WEAPON_POSITIONS )
{
C_BaseCombatWeapon *pWeapon = GetWeaponInSlot( m_iSelectedSlot, iZeroPos );
if ( pWeapon )
break;
iZeroPos++;
}
if ( iZeroPos == m_iSelectedBoxPosition )
{
newSlot = ( m_iSelectedSlot + 2 ) % 4;
m_iSelectedBoxPosition = increment = 0;
}
}
else
#endif
if ( 0 == m_iSelectedBoxPosition )
{
newSlot = ( m_iSelectedSlot + 2 ) % 4;
@ -1403,6 +1450,35 @@ void CHudWeaponSelection::PlusTypeFastWeaponSwitch( int iWeaponSlot )
}
}
#ifdef MAPBASE
if (!hud_showemptyweaponslots.GetBool())
{
// Skip empty slots
int i = m_iSelectedBoxPosition + increment;
while ( i >= 0 && i < lastSlotPos )
{
C_BaseCombatWeapon *pWeapon = GetWeaponInSlot( newSlot, i );
if ( !pWeapon )
{
if (increment < 0)
{
increment--;
i--;
}
else
{
increment++;
i++;
}
}
else
{
break;
}
}
}
#endif
// Increment/Decrement the selected box position
if ( m_iSelectedBoxPosition + increment <= lastSlotPos )
{

View File

@ -1302,7 +1302,7 @@ void CHudCloseCaption::Reset( void )
Unlock();
}
bool CHudCloseCaption::SplitCommand( wchar_t const **ppIn, wchar_t *cmd, wchar_t *args ) const
bool CHudCloseCaption::SplitCommand( wchar_t const **ppIn, wchar_t *cmd, wchar_t *args, int size ) const
{
const wchar_t *in = *ppIn;
const wchar_t *oldin = in;
@ -1317,8 +1317,11 @@ bool CHudCloseCaption::SplitCommand( wchar_t const **ppIn, wchar_t *cmd, wchar_t
cmd[ 0 ]= 0;
wchar_t *out = cmd;
in++;
while ( *in != L'\0' && *in != L':' && *in != L'>' && !isspace( *in ) )
while ( *in != L'\0' && *in != L':' && *in != L'>' && !V_isspace( *in ) )
{
if ( (int)( out - cmd ) + (int)sizeof( wchar_t ) >= size )
break;
*out++ = *in++;
}
*out = L'\0';
@ -1333,6 +1336,9 @@ bool CHudCloseCaption::SplitCommand( wchar_t const **ppIn, wchar_t *cmd, wchar_t
out = args;
while ( *in != L'\0' && *in != L'>' )
{
if ( (int)( out - args ) + (int)sizeof( wchar_t ) >= size )
break;
*out++ = *in++;
}
*out = L'\0';
@ -1360,7 +1366,7 @@ bool CHudCloseCaption::GetFloatCommandValue( const wchar_t *stream, const wchar_
wchar_t cmd[ 256 ];
wchar_t args[ 256 ];
if ( SplitCommand( &curpos, cmd, args ) )
if ( SplitCommand( &curpos, cmd, args, sizeof( cmd ) ) )
{
if ( !wcscmp( cmd, findcmd ) )
{
@ -1384,7 +1390,7 @@ bool CHudCloseCaption::StreamHasCommand( const wchar_t *stream, const wchar_t *f
wchar_t cmd[ 256 ];
wchar_t args[ 256 ];
if ( SplitCommand( &curpos, cmd, args ) )
if ( SplitCommand( &curpos, cmd, args, sizeof( cmd ) ) )
{
if ( !wcscmp( cmd, findcmd ) )
{
@ -1423,7 +1429,7 @@ bool CHudCloseCaption::StreamHasCommand( const wchar_t *stream, const wchar_t *s
wchar_t cmd[ 256 ];
wchar_t args[ 256 ];
if ( SplitCommand( &curpos, cmd, args ) )
if ( SplitCommand( &curpos, cmd, args, sizeof( cmd ) ) )
{
if ( !wcscmp( cmd, search ) )
{
@ -1490,9 +1496,23 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
if ( m_Items.Count() > 0 )
{
#ifndef MAPBASE
// Get the remaining life span of the last item
CCloseCaptionItem *final = m_Items[ m_Items.Count() - 1 ];
CCloseCaptionItem* final = m_Items[m_Items.Count() - 1];
float prevlife = final->GetTimeToLive();
#else
float prevlife = 0.f;
// Get the remaining life span of the last displayed item
for (int i = m_Items.Count() - 1; i >= 0; i--)
{
if (m_Items[i]->GetPreDisplayTime() > cc_predisplay_time.GetFloat())
continue;
prevlife = m_Items[i]->GetTimeToLive();
break;
}
#endif // !MAPBASE
if ( prevlife > lifespan )
{
@ -1515,7 +1535,7 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
const wchar_t *prevpos = curpos;
if ( SplitCommand( &curpos, cmd, args ) )
if ( SplitCommand( &curpos, cmd, args, sizeof( cmd ) ) )
{
if ( !wcscmp( cmd, L"delay" ) )
{
@ -1526,7 +1546,31 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
if ( wcslen( phrase ) > 0 )
{
CCloseCaptionItem *item = new CCloseCaptionItem( phrase, lifespan, addedlife, delay, valid, fromplayer );
m_Items.AddToTail( item );
#ifdef MAPBASE
if (m_Items.Count())
{
// Add it where it will appear
for (int i = m_Items.Count() - 1; i >= 0; i--)
{
if (m_Items[i]->GetPreDisplayTime() > delay + cc_predisplay_time.GetFloat())
{
if (i == 0)
{
m_Items.AddToHead(item);
break;
}
else
continue;
}
m_Items.InsertAfter(i, item);
break;
}
}
else
#endif // MAPBASE
m_Items.AddToTail(item);
if ( StreamHasCommand( phrase, L"sfx" ) )
{
// SFX show up instantly.
@ -1535,6 +1579,9 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
if ( GetFloatCommandValue( phrase, L"len", override_duration ) )
{
#ifdef MAPBASE
override_duration += cc_linger_time.GetFloat();
#endif // MAPBASE
item->SetTimeToLive( override_duration );
}
}
@ -1563,7 +1610,30 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
if ( wcslen( phrase ) > 0 )
{
CCloseCaptionItem *item = new CCloseCaptionItem( phrase, lifespan, addedlife, delay, valid, fromplayer );
m_Items.AddToTail( item );
#ifdef MAPBASE
if (m_Items.Count())
{
// Add it where it will appear
for (int i = m_Items.Count() - 1; i >= 0; i--)
{
if (m_Items[i]->GetPreDisplayTime() > delay + cc_predisplay_time.GetFloat())
{
if (i == 0)
{
m_Items.AddToHead(item);
break;
}
else
continue;
}
m_Items.InsertAfter(i, item);
break;
}
}
else
#endif // MAPBASE
m_Items.AddToTail(item);
if ( StreamHasCommand( phrase, L"sfx" ) )
{
@ -1573,6 +1643,10 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
if ( GetFloatCommandValue( phrase, L"len", override_duration ) )
{
#ifdef MAPBASE
override_duration += cc_linger_time.GetFloat();
#endif // MAPBASE
item->SetTimeToLive( override_duration );
item->SetInitialLifeSpan( override_duration );
}
@ -1612,6 +1686,9 @@ struct WorkUnitParams
clr = Color( 255, 255, 255, 255 );
newline = false;
font = 0;
#ifdef MAPBASE
customFont = false;
#endif
}
~WorkUnitParams()
@ -1657,6 +1734,9 @@ struct WorkUnitParams
Color clr;
bool newline;
vgui::HFont font;
#ifdef MAPBASE
bool customFont;
#endif
};
void CHudCloseCaption::AddWorkUnit( CCloseCaptionItem *item,
@ -1716,7 +1796,7 @@ void CHudCloseCaption::ComputeStreamWork( int available_width, CCloseCaptionItem
wchar_t cmd[ 256 ];
wchar_t args[ 256 ];
if ( SplitCommand( &curpos, cmd, args ) )
if ( SplitCommand( &curpos, cmd, args, sizeof( cmd ) ) )
{
if ( !wcscmp( cmd, L"cr" ) )
{
@ -1771,16 +1851,46 @@ void CHudCloseCaption::ComputeStreamWork( int available_width, CCloseCaptionItem
{
AddWorkUnit( item, params );
params.italic = !params.italic;
#ifdef MAPBASE
params.customFont = false;
#endif
}
else if ( !wcscmp( cmd, L"B" ) )
{
AddWorkUnit( item, params );
params.bold = !params.bold;
#ifdef MAPBASE
params.customFont = false;
#endif
}
#ifdef MAPBASE
else if ( !wcscmp( cmd, L"font" ) )
{
AddWorkUnit( item, params );
vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( GetScheme() );
if ( args[0] != 0 )
{
char font[64];
g_pVGuiLocalize->ConvertUnicodeToANSI( args, font, sizeof( font ) );
params.font = pScheme->GetFont( font );
params.customFont = true;
}
else
{
params.customFont = false;
}
}
#endif
continue;
}
vgui::HFont useF = params.font;
#ifdef MAPBASE
if (params.customFont == false)
#endif
{
int font;
if ( IsPC() )
{
@ -1790,8 +1900,9 @@ void CHudCloseCaption::ComputeStreamWork( int available_width, CCloseCaptionItem
{
font = streamlen >= cc_smallfontlength.GetInt() ? CCFONT_SMALL : CCFONT_NORMAL;
}
vgui::HFont useF = m_hFonts[font];
useF = m_hFonts[font];
params.font = useF;
}
int w, h;
@ -1939,7 +2050,7 @@ bool CHudCloseCaption::GetNoRepeatValue( const wchar_t *caption, float &retval )
wchar_t cmd[ 256 ];
wchar_t args[ 256 ];
if ( SplitCommand( &curpos, cmd, args ) )
if ( SplitCommand( &curpos, cmd, args, sizeof( cmd ) ) )
{
if ( !wcscmp( cmd, L"norepeat" ) )
{
@ -2571,8 +2682,14 @@ void CHudCloseCaption::InitCaptionDictionary( const char *dbfile )
g_AsyncCaptionResourceManager.Clear();
#ifdef MAPBASE
int iBufferSize = filesystem->GetSearchPath("GAME", true, nullptr, 0);
char* searchPaths = (char*)stackalloc(iBufferSize);
filesystem->GetSearchPath("GAME", true, searchPaths, iBufferSize);
#else
char searchPaths[4096];
filesystem->GetSearchPath( "GAME", true, searchPaths, sizeof( searchPaths ) );
#endif
for ( char *path = strtok( searchPaths, ";" ); path; path = strtok( NULL, ";" ) )
{
@ -2583,8 +2700,13 @@ void CHudCloseCaption::InitCaptionDictionary( const char *dbfile )
}
char fullpath[MAX_PATH];
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", path, dbfile );
Q_FixSlashes( fullpath );
#ifndef MAPBASE
Q_snprintf(fullpath, sizeof(fullpath), "%s%s", path, dbfile);
Q_FixSlashes(fullpath);
#else
V_ComposeFileName(path, dbfile, fullpath, sizeof(fullpath));
#endif // !MAPBASE
if ( IsX360() )
{
@ -2630,6 +2752,123 @@ void CHudCloseCaption::InitCaptionDictionary( const char *dbfile )
g_AsyncCaptionResourceManager.SetDbInfo( m_AsyncCaptions );
}
#ifdef MAPBASE
void CHudCloseCaption::AddAdditionalCaptionDictionary( const char *dbfile, CUtlVector<CUtlSymbol> &outPathSymbols )
{
CGMsg( 1, CON_GROUP_MAPBASE_MISC, "Adding additional caption dictionary \"%s\"\n", dbfile );
g_AsyncCaptionResourceManager.Clear();
char searchPaths[4096];
filesystem->GetSearchPath( "MOD", true, searchPaths, sizeof( searchPaths ) );
for ( char *path = strtok( searchPaths, ";" ); path; path = strtok( NULL, ";" ) )
{
if ( IsX360() && ( filesystem->GetDVDMode() == DVDMODE_STRICT ) && !V_stristr( path, ".zip" ) )
{
// only want zip paths
continue;
}
char fullpath[MAX_PATH];
V_ComposeFileName(path, dbfile, fullpath, sizeof(fullpath));
if ( IsX360() )
{
char fullpath360[MAX_PATH];
UpdateOrCreateCaptionFile( fullpath, fullpath360, sizeof( fullpath360 ) );
Q_strncpy( fullpath, fullpath360, sizeof( fullpath ) );
}
// Seach for this dictionary. If it already exists, remove it.
for (int i = 0; i < m_AsyncCaptions.Count(); ++i)
{
if (FStrEq( m_AsyncCaptions[i].m_DataBaseFile.String(), fullpath ))
{
m_AsyncCaptions.Remove( i );
break;
}
}
FileHandle_t fh = filesystem->Open( fullpath, "rb" );
if ( FILESYSTEM_INVALID_HANDLE != fh )
{
MEM_ALLOC_CREDIT();
CUtlBuffer dirbuffer;
AsyncCaption_t& entry = m_AsyncCaptions[ m_AsyncCaptions.AddToTail() ];
// Read the header
filesystem->Read( &entry.m_Header, sizeof( entry.m_Header ), fh );
if ( entry.m_Header.magic != COMPILED_CAPTION_FILEID )
Error( "Invalid file id for %s\n", fullpath );
if ( entry.m_Header.version != COMPILED_CAPTION_VERSION )
Error( "Invalid file version for %s\n", fullpath );
if ( entry.m_Header.directorysize < 0 || entry.m_Header.directorysize > 64 * 1024 )
Error( "Invalid directory size %d for %s\n", entry.m_Header.directorysize, fullpath );
//if ( entry.m_Header.blocksize != MAX_BLOCK_SIZE )
// Error( "Invalid block size %d, expecting %d for %s\n", entry.m_Header.blocksize, MAX_BLOCK_SIZE, fullpath );
int directoryBytes = entry.m_Header.directorysize * sizeof( CaptionLookup_t );
entry.m_CaptionDirectory.EnsureCapacity( entry.m_Header.directorysize );
dirbuffer.EnsureCapacity( directoryBytes );
filesystem->Read( dirbuffer.Base(), directoryBytes, fh );
filesystem->Close( fh );
entry.m_CaptionDirectory.CopyArray( (const CaptionLookup_t *)dirbuffer.PeekGet(), entry.m_Header.directorysize );
entry.m_CaptionDirectory.RedoSort( true );
entry.m_DataBaseFile = fullpath;
outPathSymbols.AddToTail( entry.m_DataBaseFile );
}
}
g_AsyncCaptionResourceManager.SetDbInfo( m_AsyncCaptions );
}
void CHudCloseCaption::AddCustomCaptionFile( char const *file, CUtlVector<CUtlSymbol> &outPathSymbols )
{
//
// 'file' should be something like "maps/mapbase_demo01_closecaption_%language%"
//
CGMsg( 1, CON_GROUP_MAPBASE_MISC, "Adding custom caption file \"%s\"\n", file );
if (!IsX360())
{
g_pVGuiLocalize->AddFile( file, "MOD", true );
}
char uilanguage[64];
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
char dbfile[512];
V_StrSubst( file, "%language%", uilanguage, dbfile, sizeof( dbfile ) );
V_SetExtension( dbfile, ".dat", sizeof( dbfile ) );
AddAdditionalCaptionDictionary( dbfile, outPathSymbols );
}
void CHudCloseCaption::RemoveCaptionDictionary( const CUtlSymbol &dbFileSymbol )
{
//
// 'file' should be something like "maps/mapbase_demo01_closecaption_%language%"
//
CGMsg( 1, CON_GROUP_MAPBASE_MISC, "Removing custom caption file \"%s\"\n", dbFileSymbol.String() );
for (int i = 0; i < m_AsyncCaptions.Count(); ++i)
{
if ( m_AsyncCaptions[i].m_DataBaseFile == dbFileSymbol )
{
m_AsyncCaptions.Remove( i );
break;
}
}
}
#endif
void CHudCloseCaption::OnFinishAsyncLoad( int nFileIndex, int nBlockNum, AsyncCaptionData_t *pData )
{
// Fill in data for all users of pData->m_nBlockNum

View File

@ -111,6 +111,11 @@ public:
void PlayRandomCaption();
void InitCaptionDictionary( char const *dbfile );
#ifdef MAPBASE
void AddAdditionalCaptionDictionary( char const *dbfile, CUtlVector<CUtlSymbol> &outPathSymbols );
void AddCustomCaptionFile( char const *file, CUtlVector<CUtlSymbol> &outPathSymbols );
void RemoveCaptionDictionary( const CUtlSymbol &dbFileSymbol );
#endif
void OnFinishAsyncLoad( int nFileIndex, int nBlockNum, AsyncCaptionData_t *pData );
void Flush();
@ -133,6 +138,11 @@ public:
void FindSound( char const *pchANSI );
#ifdef MAPBASE
inline bool IsUsingCommentaryDimensions() const { return m_bUsingCommentaryDimensions; }
inline void SetUsingCommentaryDimensions( bool bToggle ) { m_bUsingCommentaryDimensions = bToggle; }
#endif
public:
struct CaptionRepeat
@ -169,7 +179,7 @@ private:
void DrawStream( wrect_t& rect, wrect_t &rcWindow, CCloseCaptionItem *item, int iFadeLine, float flFadeLineAlpha );
void ComputeStreamWork( int available_width, CCloseCaptionItem *item );
bool SplitCommand( wchar_t const **ppIn, wchar_t *cmd, wchar_t *args ) const;
bool SplitCommand( wchar_t const **ppIn, wchar_t *cmd, wchar_t *args, int size ) const;
bool StreamHasCommand( const wchar_t *stream, const wchar_t *findcmd ) const;
bool GetFloatCommandValue( const wchar_t *stream, const wchar_t *findcmd, float& value ) const;
@ -212,6 +222,10 @@ private:
bool m_bVisibleDueToDirect;
bool m_bPaintDebugInfo;
CUtlSymbol m_CurrentLanguage;
#ifdef MAPBASE
bool m_bUsingCommentaryDimensions;
#endif
};
#endif // HUD_CLOSECAPTION_H

View File

@ -528,15 +528,15 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD
{
CLCDItem *newItem = NULL;
CLCDItem *item = ag->m_Definition[ r ];
switch ( item->m_Type )
CLCDItem *itemLocl = ag->m_Definition[ r ];
switch ( itemLocl->m_Type )
{
default:
break;
case LCDITEM_TEXT:
{
CLCDItemText *text = static_cast< CLCDItemText * >( item );
CLCDItemText *text = static_cast< CLCDItemText * >( itemLocl );
CUtlString s;
s = text->m_OriginalText;
Replace( s, prefix, s1 );
@ -551,7 +551,7 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD
// text->m_OriginalText = s;
CLCDItemText *copy = static_cast< CLCDItemText * >( page->Alloc( item->m_Type ) );
CLCDItemText *copy = static_cast< CLCDItemText * >( page->Alloc( itemLocl->m_Type ) );
*copy = *text;
copy->m_bActive = true;
copy->m_OriginalText = s;
@ -564,8 +564,8 @@ void CLCD::ShowItems_R( CLCDPage *page, unsigned int dwCurTime, CUtlVector< CLCD
break;
case LCDITEM_ICON:
{
CLCDItemIcon *icon = static_cast< CLCDItemIcon * >( item );
CLCDItemIcon *copy = static_cast< CLCDItemIcon * >( page->Alloc( item->m_Type ) );
CLCDItemIcon *icon = static_cast< CLCDItemIcon * >( itemLocl );
CLCDItemIcon *copy = static_cast< CLCDItemIcon * >( page->Alloc( itemLocl->m_Type ) );
*copy = *icon;
copy->m_bActive = true;
copy->Create( m_lcd );
@ -1186,16 +1186,16 @@ void CLCD::DumpPlayer()
C_Team *team = player->GetTeam();
if ( team )
{
CDescribeData helper( team );
helper.DumpDescription( team->GetPredDescMap() );
CDescribeData helperLocl( team );
helperLocl.DumpDescription( team->GetPredDescMap() );
}
Msg( "(playerresource)\n\n" );
if ( g_PR )
{
CDescribeData helper( g_PR );
helper.DumpDescription( g_PR->GetPredDescMap() );
CDescribeData helperLocl( g_PR );
helperLocl.DumpDescription( g_PR->GetPredDescMap() );
}
Msg( "(localplayerweapon)\n\n" );
@ -1203,8 +1203,8 @@ void CLCD::DumpPlayer()
C_BaseCombatWeapon *active = player->GetActiveWeapon();
if ( active )
{
CDescribeData helper( active );
helper.DumpDescription( active->GetPredDescMap() );
CDescribeData helperLocl( active );
helperLocl.DumpDescription( active->GetPredDescMap() );
}
Msg( "Other replacements:\n\n" );

View File

@ -10,7 +10,7 @@
#include "iclientmode.h"
#include <vgui/ILocalize.h>
#include <vgui/ISurface.h>
#include <vgui/IVGUI.h>
#include <vgui/IVGui.h>
#include <vgui_controls/EditablePanel.h>
#include <vgui_controls/Controls.h>
#include <vgui_controls/Label.h>

View File

@ -34,7 +34,7 @@
#define LOCATOR_ICON_FX_FADE_OUT 0x00000800 // Set when deactivated so it can smoothly vanish
#define LOCATOR_ICON_FX_FADE_IN 0x00001000 // Set when activated so it can smoothly appear
#include "tier1/UtlSymbol.h"
#include "tier1/utlsymbol.h"
// See comments in UtlSymbol on why this is useful
DECLARE_PRIVATE_SYMBOLTYPE( CGameInstructorSymbol );

View File

@ -21,9 +21,15 @@ static CPDumpPanel *g_pPDumpPanel = NULL;
// we pragma'd away in platform.h, so this little compiler specific hack will eliminate those warnings while
// retaining our own warning setup...ywb
#ifdef WIN32
#if _MSC_VER < 1900
#pragma warning( push )
#include <typeinfo.h>
#pragma warning( pop )
#else
#include <typeinfo>
#endif
#endif
using namespace vgui;

View File

@ -58,6 +58,9 @@ public:
// Hidden bits.
// HIDEHUD_ flags that note when this element should be hidden in the HUD
virtual void SetHiddenBits( int iBits );
#ifdef MAPBASE_VSCRIPT
int GetHiddenBits() const { return m_iHiddenBits; }
#endif
bool IsParentedToClientDLLRootPanel() const;
void SetParentedToClientDLLRootPanel( bool parented );

View File

@ -112,6 +112,11 @@ public:
virtual bool CanRecordDemo( char *errorMsg, int length ) const = 0;
#ifdef MAPBASE // From Alien Swarm SDK
virtual void OnColorCorrectionWeightsReset( void ) = 0;
virtual float GetColorCorrectionScale( void ) const = 0;
#endif
virtual void ComputeVguiResConditions( KeyValues *pkvConditions ) = 0;
//=============================================================================

View File

@ -25,7 +25,9 @@
#include "tier0/icommandline.h"
#include "inputsystem/iinputsystem.h"
#include "inputsystem/ButtonCode.h"
#if _MSC_VER < 1900
#include "math.h"
#endif
#include "tier1/convar_serverbounded.h"
#include "cam_thirdperson.h"

View File

@ -115,6 +115,13 @@ public:
virtual void SetScreenOverlayMaterial( IMaterial *pMaterial ) = 0;
virtual IMaterial *GetScreenOverlayMaterial( ) = 0;
#ifdef MAPBASE
virtual void SetIndexedScreenOverlayMaterial( int i, IMaterial *pMaterial ) = 0;
virtual IMaterial *GetIndexedScreenOverlayMaterial( int i ) = 0;
virtual void ResetIndexedScreenOverlays() = 0;
virtual int GetMaxIndexedScreenOverlays() const = 0;
#endif
virtual void WriteSaveGameScreenshot( const char *pFilename ) = 0;
virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height, bool bCreatePowerOf2Padded = false, bool bWriteVTF = false ) = 0;

View File

@ -1,6 +1,6 @@
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
//
// Purpose: Recreates Portal 2 linked_portal_door functionality using SDK code only.
// Purpose: Recreates Portal 2 linked_portal_door visual functionality using SDK code only.
// (basically a combination of point_camera and func_reflective_glass)
//
// $NoKeywords: $
@ -58,70 +58,11 @@ bool C_FuncFakeWorldPortal::ShouldDraw()
}
//-----------------------------------------------------------------------------
// Do we have a fake world portal in view?
//-----------------------------------------------------------------------------
C_FuncFakeWorldPortal *IsFakeWorldPortalInView( const CViewSetup& view, cplane_t &plane )
{
// Early out if no cameras
C_FuncFakeWorldPortal *pReflectiveGlass = GetFakeWorldPortalList();
if ( !pReflectiveGlass )
return NULL;
Frustum_t frustum;
GeneratePerspectiveFrustum( view.origin, view.angles, view.zNear, view.zFar, view.fov, view.m_flAspectRatio, frustum );
cplane_t localPlane;
Vector vecOrigin, vecWorld, vecDelta, vecForward;
AngleVectors( view.angles, &vecForward, NULL, NULL );
for ( ; pReflectiveGlass != NULL; pReflectiveGlass = pReflectiveGlass->m_pNext )
{
if ( pReflectiveGlass->IsDormant() )
continue;
if ( pReflectiveGlass->m_iViewHideFlags & (1 << CurrentViewID()) )
continue;
Vector vecMins, vecMaxs;
pReflectiveGlass->GetRenderBoundsWorldspace( vecMins, vecMaxs );
if ( R_CullBox( vecMins, vecMaxs, frustum ) )
continue;
const model_t *pModel = pReflectiveGlass->GetModel();
const matrix3x4_t& mat = pReflectiveGlass->EntityToWorldTransform();
int nCount = modelinfo->GetBrushModelPlaneCount( pModel );
for ( int i = 0; i < nCount; ++i )
{
modelinfo->GetBrushModelPlane( pModel, i, localPlane, &vecOrigin );
MatrixTransformPlane( mat, localPlane, plane ); // Transform to world space
VectorTransform( vecOrigin, mat, vecWorld );
if ( view.origin.Dot( plane.normal ) <= plane.dist ) // Check for view behind plane
continue;
VectorSubtract( vecWorld, view.origin, vecDelta ); // Backface cull
if ( vecDelta.Dot( plane.normal ) >= 0 )
continue;
// Must have valid plane
if ( !pReflectiveGlass->m_hTargetPlane )
continue;
return pReflectiveGlass;
}
}
return NULL;
}
//-----------------------------------------------------------------------------
// Iterates through fake world portals instead of just picking one
//-----------------------------------------------------------------------------
C_FuncFakeWorldPortal *NextFakeWorldPortal( C_FuncFakeWorldPortal *pStart, const CViewSetup& view, cplane_t &plane,
const Frustum_t &frustum )
C_FuncFakeWorldPortal *NextFakeWorldPortal( C_FuncFakeWorldPortal *pStart, const CViewSetup& view,
Vector &vecAbsPlaneNormal, float &flLocalPlaneDist, const Frustum_t &frustum )
{
// Early out if no cameras
C_FuncFakeWorldPortal *pReflectiveGlass = NULL;
@ -130,8 +71,9 @@ C_FuncFakeWorldPortal *NextFakeWorldPortal( C_FuncFakeWorldPortal *pStart, const
else
pReflectiveGlass = pStart->m_pNext;
cplane_t localPlane;
Vector vecOrigin, vecWorld, vecDelta;
cplane_t localPlane, worldPlane;
Vector vecMins, vecMaxs, vecLocalOrigin, vecAbsOrigin, vecDelta;
for ( ; pReflectiveGlass != NULL; pReflectiveGlass = pReflectiveGlass->m_pNext )
{
if ( pReflectiveGlass->IsDormant() )
@ -140,7 +82,10 @@ C_FuncFakeWorldPortal *NextFakeWorldPortal( C_FuncFakeWorldPortal *pStart, const
if ( pReflectiveGlass->m_iViewHideFlags & (1 << CurrentViewID()) )
continue;
Vector vecMins, vecMaxs;
// Must have valid plane
if ( !pReflectiveGlass->m_hTargetPlane )
continue;
pReflectiveGlass->GetRenderBoundsWorldspace( vecMins, vecMaxs );
if ( R_CullBox( vecMins, vecMaxs, frustum ) )
continue;
@ -151,21 +96,21 @@ C_FuncFakeWorldPortal *NextFakeWorldPortal( C_FuncFakeWorldPortal *pStart, const
int nCount = modelinfo->GetBrushModelPlaneCount( pModel );
for ( int i = 0; i < nCount; ++i )
{
modelinfo->GetBrushModelPlane( pModel, i, localPlane, &vecOrigin );
modelinfo->GetBrushModelPlane( pModel, i, localPlane, &vecLocalOrigin );
MatrixTransformPlane( mat, localPlane, plane ); // Transform to world space
VectorTransform( vecOrigin, mat, vecWorld );
MatrixTransformPlane( mat, localPlane, worldPlane ); // Transform to world space
if ( view.origin.Dot( plane.normal ) <= plane.dist ) // Check for view behind plane
if ( view.origin.Dot( worldPlane.normal ) <= worldPlane.dist ) // Check for view behind plane
continue;
VectorSubtract( vecWorld, view.origin, vecDelta ); // Backface cull
if ( vecDelta.Dot( plane.normal ) >= 0 )
VectorTransform( vecLocalOrigin, mat, vecAbsOrigin );
VectorSubtract( vecAbsOrigin, view.origin, vecDelta );
if ( vecDelta.Dot( worldPlane.normal ) >= 0 ) // Backface cull
continue;
// Must have valid plane
if ( !pReflectiveGlass->m_hTargetPlane )
continue;
flLocalPlaneDist = localPlane.dist;
vecAbsPlaneNormal = worldPlane.normal;
return pReflectiveGlass;
}

View File

@ -53,10 +53,8 @@ public:
//-----------------------------------------------------------------------------
// Do we have reflective glass in view? If so, what's the reflection plane?
//-----------------------------------------------------------------------------
C_FuncFakeWorldPortal *IsFakeWorldPortalInView( const CViewSetup& view, cplane_t &plane );
C_FuncFakeWorldPortal *NextFakeWorldPortal( C_FuncFakeWorldPortal *pStart, const CViewSetup& view, cplane_t &plane,
const Frustum_t &frustum );
C_FuncFakeWorldPortal *NextFakeWorldPortal( C_FuncFakeWorldPortal *pStart, const CViewSetup& view,
Vector &vecAbsPlaneNormal, float &flLocalPlaneDist, const Frustum_t &frustum );
#endif // C_FUNC_FAKE_WORLDPORTAL

View File

@ -0,0 +1,289 @@
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
//
// Purpose: Displays easy, flexible VGui text. Mapbase equivalent of point_worldtext.
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "panelmetaclassmgr.h"
#include "VGuiMatSurface/IMatSystemSurface.h"
#include <vgui/IInput.h>
#include <vgui/IPanel.h>
#include <vgui/IVGui.h>
#include "ienginevgui.h"
#include "c_vguiscreen.h"
#include "vgui_bitmapbutton.h"
#include "vgui_bitmappanel.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
using namespace vgui;
//-----------------------------------------------------------------------------
// vgui_text_display
//-----------------------------------------------------------------------------
class C_VGuiTextDisplay : public C_BaseEntity
{
public:
DECLARE_CLASS( C_VGuiTextDisplay, C_BaseEntity );
DECLARE_CLIENTCLASS();
C_VGuiTextDisplay();
~C_VGuiTextDisplay();
virtual void PostDataUpdate( DataUpdateType_t updateType );
bool IsEnabled( void ) const { return m_bEnabled; }
const char *GetDisplayText( void ) const { return m_szDisplayText; }
const char *GetFontName( void ) const { return m_szFont; }
int GetResolution( void ) const { return m_iResolution; }
vgui::Label::Alignment GetContentAlignment() const { return m_iContentAlignment; }
bool NeedsTextUpdate() { return m_bTextNeedsUpdate; }
void UpdatedText() { m_bTextNeedsUpdate = false; }
private:
bool m_bEnabled;
char m_szDisplayText[256];
vgui::Label::Alignment m_iContentAlignment;
char m_szFont[64];
int m_iResolution;
bool m_bTextNeedsUpdate;
};
IMPLEMENT_CLIENTCLASS_DT( C_VGuiTextDisplay, DT_VGuiTextDisplay, CVGuiTextDisplay )
RecvPropBool( RECVINFO( m_bEnabled ) ),
RecvPropString( RECVINFO( m_szDisplayText ) ),
RecvPropInt( RECVINFO( m_iContentAlignment ) ),
RecvPropString( RECVINFO( m_szFont ) ),
RecvPropInt( RECVINFO( m_iResolution ) ),
END_RECV_TABLE()
C_VGuiTextDisplay::C_VGuiTextDisplay()
{
}
C_VGuiTextDisplay::~C_VGuiTextDisplay()
{
}
void C_VGuiTextDisplay::PostDataUpdate( DataUpdateType_t updateType )
{
BaseClass::PostDataUpdate( updateType );
// For now, always update
m_bTextNeedsUpdate = true;
}
using namespace vgui;
//-----------------------------------------------------------------------------
// Control screen
//-----------------------------------------------------------------------------
class C_TextDisplayPanel : public CVGuiScreenPanel
{
DECLARE_CLASS( C_TextDisplayPanel, CVGuiScreenPanel );
public:
C_TextDisplayPanel( vgui::Panel *parent, const char *panelName );
~C_TextDisplayPanel( void );
virtual void ApplySchemeSettings( IScheme *pScheme );
void UpdateText();
virtual bool Init( KeyValues* pKeyValues, VGuiScreenInitData_t* pInitData );
virtual void OnTick( void );
virtual void Paint( void );
private:
CHandle<C_VGuiScreen> m_hVGUIScreen;
CHandle<C_VGuiTextDisplay> m_hScreenEntity;
// VGUI specifics
Label *m_pDisplayTextLabel;
};
DECLARE_VGUI_SCREEN_FACTORY( C_TextDisplayPanel, "text_display_panel" );
CUtlVector <C_TextDisplayPanel *> g_TextDisplays;
//-----------------------------------------------------------------------------
// Constructor:
//-----------------------------------------------------------------------------
C_TextDisplayPanel::C_TextDisplayPanel( vgui::Panel *parent, const char *panelName )
: BaseClass( parent, "C_TextDisplayPanel"/*, vgui::scheme()->LoadSchemeFromFileEx( enginevgui->GetPanel( PANEL_CLIENTDLL ), "resource/WorldTextPanel.res", "WorldTextPanel" )*/ )
{
// Add ourselves to the global list of movie displays
g_TextDisplays.AddToTail( this );
}
//-----------------------------------------------------------------------------
// Purpose: Clean up the movie
//-----------------------------------------------------------------------------
C_TextDisplayPanel::~C_TextDisplayPanel( void )
{
// Remove ourselves from the global list of movie displays
g_TextDisplays.FindAndRemove( this );
}
//-----------------------------------------------------------------------------
// Purpose: Setup our scheme
//-----------------------------------------------------------------------------
void C_TextDisplayPanel::ApplySchemeSettings( IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
/*
m_pDisplayTextLabel->SetFgColor( Color( 255, 255, 255, 255 ) );
m_pDisplayTextLabel->SetText( "" );
m_pDisplayTextLabel->SetVisible( false );
*/
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_TextDisplayPanel::UpdateText()
{
color32 clr = m_hScreenEntity->GetRenderColor();
m_pDisplayTextLabel->SetFgColor( Color( clr.r, clr.g, clr.b, clr.a ) );
m_pDisplayTextLabel->SetText( m_hScreenEntity->GetDisplayText() );
//SetSize( m_hScreenEntity->GetTextSize(), m_hScreenEntity->GetTextSize() );
//m_pDisplayTextLabel->SetSize( m_hScreenEntity->GetTextSize(), m_hScreenEntity->GetTextSize() );
Label::Alignment iAlignment = m_hScreenEntity->GetContentAlignment();
switch (iAlignment)
{
// Use a special scaling method when using a south alignment
case Label::Alignment::a_southwest:
case Label::Alignment::a_south:
case Label::Alignment::a_southeast:
int lW, lT;
m_pDisplayTextLabel->GetContentSize( lW, lT );
SetSize( m_hScreenEntity->GetResolution(), lT );
m_pDisplayTextLabel->SetSize( m_hScreenEntity->GetResolution(), lT );
float sW, sT;
m_hVGUIScreen->GetSize( sW, sT );
//Msg( "Screen width: %f, new height: %f\n", sW, sW * (lT / m_hScreenEntity->GetResolution()) );
m_hVGUIScreen->SetHeight( sW * ((float)lT / (float)m_hScreenEntity->GetResolution()) );
m_hVGUIScreen->SetPixelHeight( lT );
break;
default:
SetSize( m_hScreenEntity->GetResolution(), m_hScreenEntity->GetResolution() );
m_pDisplayTextLabel->SetSize( m_hScreenEntity->GetResolution(), m_hScreenEntity->GetResolution() );
break;
}
m_pDisplayTextLabel->SetContentAlignment( iAlignment );
bool bWrap = true;
bool bCenterWrap = false;
switch (iAlignment)
{
// Center wrap if centered
case Label::Alignment::a_north:
case Label::Alignment::a_center:
case Label::Alignment::a_south:
bCenterWrap = true;
break;
// HACKHACK: Don't wrap if using an east alignment
case Label::Alignment::a_northeast:
case Label::Alignment::a_east:
case Label::Alignment::a_southeast:
bWrap = false;
break;
}
m_pDisplayTextLabel->SetWrap( bWrap );
m_pDisplayTextLabel->SetCenterWrap( bCenterWrap );
//Msg( "Resolution is %i\n", m_hScreenEntity->GetResolution() );
const char *pszFontName = m_hScreenEntity->GetFontName();
if (pszFontName && pszFontName[0] != '\0')
{
HFont font = scheme()->GetIScheme( GetScheme() )->GetFont( pszFontName );
if ( !font )
{
extern HFont GetScriptFont( const char *, bool );
font = GetScriptFont( pszFontName, false );
}
m_pDisplayTextLabel->SetFont( font );
}
m_pDisplayTextLabel->SetVisible( true );
}
//-----------------------------------------------------------------------------
// Initialization
//-----------------------------------------------------------------------------
bool C_TextDisplayPanel::Init( KeyValues* pKeyValues, VGuiScreenInitData_t* pInitData )
{
if ( !BaseClass::Init( pKeyValues, pInitData ) )
return false;
// Make sure we get ticked...
vgui::ivgui()->AddTickSignal( GetVPanel() );
m_pDisplayTextLabel = dynamic_cast<vgui::Label*>(FindChildByName( "TextDisplay" ));
// Save this for simplicity later on
m_hVGUIScreen = dynamic_cast<C_VGuiScreen *>( GetEntity() );
if ( m_hVGUIScreen != NULL )
{
// Also get the associated entity
m_hScreenEntity = dynamic_cast<C_VGuiTextDisplay *>(m_hVGUIScreen->GetOwnerEntity());
UpdateText();
}
return true;
}
//-----------------------------------------------------------------------------
// Update the display string
//-----------------------------------------------------------------------------
void C_TextDisplayPanel::OnTick()
{
if (m_hScreenEntity->NeedsTextUpdate())
{
UpdateText();
m_hScreenEntity->UpdatedText();
}
BaseClass::OnTick();
}
ConVar r_vguitext_bg( "r_vguitext_bg", "0" );
//-----------------------------------------------------------------------------
// Purpose: Update and draw the frame
//-----------------------------------------------------------------------------
void C_TextDisplayPanel::Paint( void )
{
// Black out the background (we could omit drawing under the video surface, but this is straight-forward)
if ( r_vguitext_bg.GetBool() )
{
surface()->DrawSetColor( 0, 0, 0, 255 );
surface()->DrawFilledRect( 0, 0, GetWide(), GetTall() );
//surface()->DrawSetColor( 64, 64, 64, 255 );
//surface()->DrawFilledRect( 0, 0, m_pDisplayTextLabel->GetWide(), m_pDisplayTextLabel->GetTall() );
}
// Parent's turn
BaseClass::Paint();
}

View File

@ -0,0 +1,91 @@
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
//
// Purpose: Client classes for Half-Life 2 based custom weapons.
//
// Author: Peter Covington (petercov@outlook.com)
//
//==================================================================================//
#include "cbase.h"
#include "c_weapon__stubs.h"
#include "basehlcombatweapon_shared.h"
#include "c_basehlcombatweapon.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
class C_HLCustomWeaponMelee : public C_BaseHLBludgeonWeapon
{
public:
DECLARE_CLASS(C_HLCustomWeaponMelee, C_BaseHLBludgeonWeapon);
DECLARE_CLIENTCLASS();
DECLARE_PREDICTABLE();
C_HLCustomWeaponMelee();
void OnDataChanged( DataUpdateType_t updateType );
virtual const char* GetWeaponScriptName() { return m_iszWeaponScriptName; }
private:
char m_iszWeaponScriptName[128];
};
STUB_WEAPON_CLASS_IMPLEMENT(weapon_hlcustommelee, C_HLCustomWeaponMelee);
IMPLEMENT_CLIENTCLASS_DT(C_HLCustomWeaponMelee, DT_HLCustomWeaponMelee, CHLCustomWeaponMelee)
RecvPropString(RECVINFO(m_iszWeaponScriptName)),
END_RECV_TABLE();
C_HLCustomWeaponMelee::C_HLCustomWeaponMelee()
{
m_iszWeaponScriptName[0] = '\0';
}
void C_HLCustomWeaponMelee::OnDataChanged( DataUpdateType_t updateType )
{
if (updateType == DATA_UPDATE_CREATED)
{
Precache();
}
BaseClass::OnDataChanged( updateType );
}
class C_HLCustomWeaponGun : public C_BaseHLCombatWeapon
{
public:
DECLARE_CLASS(C_HLCustomWeaponGun, C_BaseHLCombatWeapon);
DECLARE_CLIENTCLASS();
DECLARE_PREDICTABLE();
C_HLCustomWeaponGun();
void OnDataChanged( DataUpdateType_t updateType );
virtual const char* GetWeaponScriptName() { return m_iszWeaponScriptName; }
private:
char m_iszWeaponScriptName[128];
};
STUB_WEAPON_CLASS_IMPLEMENT(weapon_hlcustomgun, C_HLCustomWeaponGun);
IMPLEMENT_CLIENTCLASS_DT(C_HLCustomWeaponGun, DT_HLCustomWeaponGun, CHLCustomWeaponGun)
RecvPropString(RECVINFO(m_iszWeaponScriptName)),
END_RECV_TABLE();
C_HLCustomWeaponGun::C_HLCustomWeaponGun()
{
m_iszWeaponScriptName[0] = '\0';
}
void C_HLCustomWeaponGun::OnDataChanged( DataUpdateType_t updateType )
{
if (updateType == DATA_UPDATE_CREATED)
{
Precache();
}
BaseClass::OnDataChanged( updateType );
}

View File

@ -0,0 +1,286 @@
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
//
// Purpose: A utility which automatically generates HDR and LDR cubemaps.
// This has the following purposes:
//
// 1. Allow both HDR and LDR cubemaps to be generated automatically after a map is compiled
// 2. Have a way to batch build cubemaps for several levels at once
//
// Author: Blixibon
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "tier0/icommandline.h"
#include "igamesystem.h"
#include "filesystem.h"
#include "utlbuffer.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
extern const char *g_MapName;
ConVar autocubemap_hdr_do_both( "autocubemap_hdr_do_both", "1" );
ConVar autocubemap_hdr_value( "autocubemap_hdr_value", "2" );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CAutoCubemapSystem : public CAutoGameSystem
{
public:
CAutoCubemapSystem() : CAutoGameSystem( "CAutoCubemapSystem" )
{
}
virtual bool Init()
{
const char *pszFile = NULL;
if (CommandLine()->CheckParm( "-autocubemap", &pszFile ))
{
if (!pszFile || pszFile[0] == '\0')
{
// Assume that we just want to autocubemap the first map we load
// (no code here for now)
}
else
{
LoadFile( pszFile );
}
// Begin autocubemap with the first level we load
m_bAutoCubemapOnFirstLevel = true;
}
return true;
}
virtual void LevelInitPostEntity()
{
if (m_bAutoCubemapActive)
{
if (m_bAutoCubemapBuildingCubemaps)
{
// Check if we need to do the other HDR level
if (autocubemap_hdr_do_both.GetBool() && !m_bAutoCubemapDoingBoth)
{
m_bAutoCubemapBuildingCubemaps = false;
m_bAutoCubemapDoingBoth = true;
// Change the HDR level and restart the map
//ConVarRef mat_hdr_level( "mat_hdr_level" );
engine->ClientCmd_Unrestricted( VarArgs( "toggle mat_hdr_level 0 %i; restart", autocubemap_hdr_value.GetInt() ) );
}
else
{
// Go to the next map
m_bAutoCubemapBuildingCubemaps = false;
m_bAutoCubemapDoingBoth = false;
m_AutoCubemapMapsIndex++;
if (m_AutoCubemapMapsIndex < m_AutoCubemapMaps.Count())
{
engine->ClientCmd_Unrestricted( VarArgs( "map %s", m_AutoCubemapMaps[m_AutoCubemapMapsIndex] ) );
}
else
{
// CUBEMAPPER FINISHED
m_AutoCubemapMaps.PurgeAndDeleteElements();
m_AutoCubemapMapsIndex = 0;
m_bAutoCubemapActive = false;
Msg( "CUBEMAPPER FINISHED\n" );
if (autocubemap_hdr_do_both.GetBool())
{
engine->ClientCmd_Unrestricted( VarArgs( "mat_hdr_level %i", m_iAutoCubemapUserHDRLevel ) );
}
}
}
}
else
{
// Build cubemaps for this map
m_bAutoCubemapBuildingCubemaps = true;
engine->ClientCmd_Unrestricted( "exec buildcubemaps_prep; buildcubemaps" );
}
}
else if (m_bAutoCubemapOnFirstLevel)
{
// Start autocubemap now
StartAutoCubemap();
m_bAutoCubemapOnFirstLevel = false;
}
}
//-------------------------------------------------------------------------------------
void StartAutoCubemap()
{
if (m_AutoCubemapMaps.Count() <= 0)
{
//Msg("No maps to cubemap with!\n");
//return;
if (C_BasePlayer::GetLocalPlayer() == NULL)
{
Msg( "Must be in a level (or have a loaded map list) to begin autocubemap\n" );
return;
}
// Just do this map
m_AutoCubemapMaps.AddToTail( strdup( g_MapName ) );
}
if (autocubemap_hdr_do_both.GetBool())
{
// Save the user's HDR level
ConVarRef mat_hdr_level( "mat_hdr_level" );
m_iAutoCubemapUserHDRLevel = mat_hdr_level.GetInt();
}
m_bAutoCubemapActive = true;
m_AutoCubemapMapsIndex = 0;
if (FStrEq( m_AutoCubemapMaps[m_AutoCubemapMapsIndex], g_MapName ))
{
// Build cubemaps right here, right now
m_bAutoCubemapBuildingCubemaps = true;
engine->ClientCmd_Unrestricted( "exec buildcubemaps_prep; buildcubemaps" );
}
else
{
// Go to that map
engine->ClientCmd_Unrestricted( VarArgs( "map %s", m_AutoCubemapMaps[m_AutoCubemapMapsIndex] ) );
}
}
void LoadFile( const char *pszFile )
{
KeyValues *pKV = new KeyValues( "AutoCubemap" );
if ( pKV->LoadFromFile( filesystem, pszFile, NULL ) )
{
KeyValues *pSubKey = pKV->GetFirstSubKey();
while ( pSubKey )
{
m_AutoCubemapMaps.AddToTail( strdup(pSubKey->GetName()) );
pSubKey = pSubKey->GetNextKey();
}
Msg( "Initted autocubemap\n" );
}
else
{
Warning( "Unable to load autocubemap file \"%s\"\n", pszFile );
}
pKV->deleteThis();
}
void Clear()
{
m_bAutoCubemapActive = false;
m_bAutoCubemapBuildingCubemaps = false;
m_bAutoCubemapDoingBoth = false;
m_AutoCubemapMaps.PurgeAndDeleteElements();
m_AutoCubemapMapsIndex = 0;
}
void PrintState()
{
char szCmd[1024] = { 0 };
if (m_AutoCubemapMaps.Count() > 0)
{
Q_strncpy( szCmd, "=== CUBEMAPPER MAP LIST ===\n", sizeof( szCmd ) );
FOR_EACH_VEC( m_AutoCubemapMaps, i )
{
Q_snprintf( szCmd, sizeof( szCmd ), "%s%s\n", szCmd, m_AutoCubemapMaps[i] );
}
Q_strncat( szCmd, "========================", sizeof( szCmd ), COPY_ALL_CHARACTERS );
Q_snprintf( szCmd, sizeof( szCmd ), "%s\nNumber of maps: %i (starting at %i)\n", szCmd, m_AutoCubemapMaps.Count(), m_AutoCubemapMapsIndex );
}
else
{
Q_strncat( szCmd, "========================\n", sizeof( szCmd ), COPY_ALL_CHARACTERS );
Q_strncat( szCmd, "There are no maps selected. Use 'autocubemap_init' to load a map list.\nIf 'autocubemap_start' is executed while no maps are selected, only the current map will have cubemaps generated.\n", sizeof( szCmd ), COPY_ALL_CHARACTERS );
Q_strncat( szCmd, "========================\n", sizeof( szCmd ), COPY_ALL_CHARACTERS );
}
Msg( "%s", szCmd );
}
//-------------------------------------------------------------------------------------
bool m_bAutoCubemapActive = false;
bool m_bAutoCubemapBuildingCubemaps = false;
bool m_bAutoCubemapDoingBoth = false;
int m_iAutoCubemapUserHDRLevel; // For setting the user back to the right HDR level when we're finished
// Start autocubemap with the first level we load (used for launch parameter)
bool m_bAutoCubemapOnFirstLevel = false;
CUtlVector<const char*> m_AutoCubemapMaps;
int m_AutoCubemapMapsIndex;
};
CAutoCubemapSystem g_AutoCubemapSystem;
CON_COMMAND( autocubemap_init, "Inits autocubemap" )
{
if (gpGlobals->maxClients > 1)
{
Msg( "Can't run autocubemap in multiplayer\n" );
return;
}
if (args.ArgC() <= 1)
{
Msg("Format: autocubemap_init <file name in the 'cfg' folder>\n");
return;
}
g_AutoCubemapSystem.LoadFile( args.Arg( 1 ) );
}
CON_COMMAND( autocubemap_print, "Prints current autocubemap information" )
{
if (gpGlobals->maxClients > 1)
{
Msg("Can't run autocubemap in multiplayer\n");
return;
}
g_AutoCubemapSystem.PrintState();
}
CON_COMMAND( autocubemap_clear, "Clears autocubemap stuff" )
{
if (gpGlobals->maxClients > 1)
{
Msg("Can't run autocubemap in multiplayer\n");
return;
}
g_AutoCubemapSystem.Clear();
}
CON_COMMAND( autocubemap_start, "Begins the autocubemap (it's recommended to check 'autocubemap_print' before running this command)" )
{
if (gpGlobals->maxClients > 1)
{
Msg("Can't run autocubemap in multiplayer\n");
return;
}
g_AutoCubemapSystem.StartAutoCubemap();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef VSCRIPT_VGUI_H
#define VSCRIPT_VGUI_H
#ifdef _WIN32
#pragma once
#endif
void RegisterScriptVGUI();
#endif

View File

@ -0,0 +1,390 @@
static const char* g_Script_vgui_init = R"script(
local DoCreateFont = ISurface.CreateFont;
function ISurface::CreateFont( name, props )
{
if ( !("name" in props) || typeof props.name != "string" )
throw "invalid parameter 'name'";
if ( !("tall" in props) || typeof props.tall != "integer" || !props.tall )
throw "invalid parameter 'tall'";
if ( !("weight" in props) || typeof props.weight != "integer" )
throw "invalid parameter 'weight'";
local yres_min = 0, yres_max = 0;
if ( "yres" in props && typeof props.yres == "string" )
{
local ss = ::split( props.yres, " " );
try
{
yres_min = ss[0].tointeger();
yres_max = ss[1].tointeger();
}
catch(x)
{
throw "invalid parameter 'yres'";
}
}
if ( ( (!("proportional" in props) || typeof props.proportional != "bool") ) && !yres_min )
{
throw "parameter 'proportional' or 'yres' not found";
}
else if ( "proportional" in props && props.proportional && yres_min )
{
throw "resolution definition on a proportional font"
}
local blur = 0, scanlines = 0, proportional = false, flags = 0;
if ( "blur" in props && typeof props.blur == "integer" )
blur = props.blur;
if ( "scanlines" in props && typeof props.scanlines == "integer" )
scanlines = props.scanlines;
if ( "proportional" in props && typeof props.proportional == "bool" )
proportional = props.proportional;
if ( "italic" in props && props.italic == true )
flags = flags | 0x001;
if ( "underline" in props && props.underline == true )
flags = flags | 0x002;
if ( "strikeout" in props && props.strikeout == true )
flags = flags | 0x004;
if ( "symbol" in props && props.symbol == true )
flags = flags | 0x008;
if ( "antialias" in props && props.antialias == true )
flags = flags | 0x010;
if ( "gaussianblur" in props && props.gaussianblur == true )
flags = flags | 0x020;
if ( "rotary" in props && props.rotary == true )
flags = flags | 0x040;
if ( "dropshadow" in props && props.dropshadow == true )
flags = flags | 0x080;
if ( "additive" in props && props.additive == true )
flags = flags | 0x100;
if ( "outline" in props && props.outline == true )
flags = flags | 0x200;
if ( "custom" in props && props.custom == true )
flags = flags | 0x400;
if ( "bitmap" in props && props.bitmap == true )
flags = flags | 0x800;
return DoCreateFont( name, props.name, props.tall, props.weight, blur, scanlines, flags, yres_min, yres_max, proportional );
}
local _FontTall = {}
local _Schemes = {}
local DoGetFont = ISurface.DoGetFont <- ISurface.GetFont;
local DoGetFontTall = ISurface.GetFontTall;
function ISurface::GetFont( name, proportional, sch = "" )
{
if ( sch in _Schemes )
{
local fonts = _Schemes[sch][proportional.tointeger()];
if ( name in fonts )
return fonts[name];
}
else
{
if ( typeof sch != "string" )
throw "invalid parameter 'scheme'";
_Schemes[sch] <- [{}, {}];
}
local id = DoGetFont( name, proportional, sch );
if ( id > 0 )
_Schemes[sch][proportional.tointeger()][name] <- id;
return id;
}
ISurface.GetFontTall <- function( id )
{
if ( id in _FontTall )
return _FontTall[id];
return _FontTall[id] <- DoGetFontTall( id );
}
local _Textures = {}
local DoGetTextureID = ISurface.GetTextureID;
local DoValidateTexture = ISurface.ValidateTexture;
local DoSetTextureFile = ISurface.SetTextureFile;
ISurface.ValidateTexture <- function( filename, hardwareFilter, forceReload = false, procedural = false )
{
return DoValidateTexture( filename, hardwareFilter, forceReload, procedural );
}
ISurface.SetTextureFile <- function( id, filename, hardwareFilter )
{
if ( filename in _Textures )
delete _Textures[filename];
return DoSetTextureFile( id, filename, hardwareFilter );
}
ISurface.GetTextureID <- function( name )
{
if ( name in _Textures )
return _Textures[name];
local id = DoGetTextureID( name );
if ( id > 0 )
_Textures[name] <- id;
return id;
}
// Forward compatibility
IVGui.GetRootPanel <- function() { return 0x8888 }
//IVGui.GetGameUIRootPanel <- function() { return 0x8888+1 }
IVGui.GetClientDLLRootPanel <- function() { return 0x8888+2 }
IVGui.GetHudViewport <- function() { return 0x8888+10 }
local CreatePanel = IVGui.CreatePanel;
function IVGui::CreatePanel( type, parent, name )
{
if ( !parent )
throw "invalid parent";
local root = -1;
if ( typeof parent == "integer" )
{
root = parent-0x8888;
switch ( root )
{
case 0:
case 2:
case 10:
break;
default: throw "invalid parent";
}
parent = null;
}
return CreatePanel( type, parent, name, root );
}
ISurface.__OnScreenSizeChanged <- function()
{
_FontTall.clear();
}
// MAX_JOYSTICKS = 1 // ( 1 << MAX_SPLITSCREEN_CLIENT_BITS )
// MAX_JOYSTICK_AXES = 6 // X,Y,Z,R,U,V
// JOYSTICK_MAX_BUTTON_COUNT = 32
// JOYSTICK_POV_BUTTON_COUNT = 4
// JOYSTICK_AXIS_BUTTON_COUNT = MAX_JOYSTICK_AXES * 2
enum ButtonCode
{
KEY_FIRST = 0
KEY_0 = 1
KEY_1 = 2
KEY_2 = 3
KEY_3 = 4
KEY_4 = 5
KEY_5 = 6
KEY_6 = 7
KEY_7 = 8
KEY_8 = 9
KEY_9 = 10
KEY_A = 11
KEY_B = 12
KEY_C = 13
KEY_D = 14
KEY_E = 15
KEY_F = 16
KEY_G = 17
KEY_H = 18
KEY_I = 19
KEY_J = 20
KEY_K = 21
KEY_L = 22
KEY_M = 23
KEY_N = 24
KEY_O = 25
KEY_P = 26
KEY_Q = 27
KEY_R = 28
KEY_S = 29
KEY_T = 30
KEY_U = 31
KEY_V = 32
KEY_W = 33
KEY_X = 34
KEY_Y = 35
KEY_Z = 36
KEY_PAD_0 = 37
KEY_PAD_1 = 38
KEY_PAD_2 = 39
KEY_PAD_3 = 40
KEY_PAD_4 = 41
KEY_PAD_5 = 42
KEY_PAD_6 = 43
KEY_PAD_7 = 44
KEY_PAD_8 = 45
KEY_PAD_9 = 46
KEY_PAD_DIVIDE = 47
KEY_PAD_MULTIPLY = 48
KEY_PAD_MINUS = 49
KEY_PAD_PLUS = 50
KEY_PAD_ENTER = 51
KEY_PAD_DECIMAL = 52
KEY_LBRACKET = 53
KEY_RBRACKET = 54
KEY_SEMICOLON = 55
KEY_APOSTROPHE = 56
KEY_BACKQUOTE = 57
KEY_COMMA = 58
KEY_PERIOD = 59
KEY_SLASH = 60
KEY_BACKSLASH = 61
KEY_MINUS = 62
KEY_EQUAL = 63
KEY_ENTER = 64
KEY_SPACE = 65
KEY_BACKSPACE = 66
KEY_TAB = 67
KEY_CAPSLOCK = 68
KEY_NUMLOCK = 69
KEY_ESCAPE = 70
KEY_SCROLLLOCK = 71
KEY_INSERT = 72
KEY_DELETE = 73
KEY_HOME = 74
KEY_END = 75
KEY_PAGEUP = 76
KEY_PAGEDOWN = 77
KEY_BREAK = 78
KEY_LSHIFT = 79
KEY_RSHIFT = 80
KEY_LALT = 81
KEY_RALT = 82
KEY_LCONTROL = 83
KEY_RCONTROL = 84
KEY_LWIN = 85
KEY_RWIN = 86
KEY_APP = 87
KEY_UP = 88
KEY_LEFT = 89
KEY_DOWN = 90
KEY_RIGHT = 91
KEY_F1 = 92
KEY_F2 = 93
KEY_F3 = 94
KEY_F4 = 95
KEY_F5 = 96
KEY_F6 = 97
KEY_F7 = 98
KEY_F8 = 99
KEY_F9 = 100
KEY_F10 = 101
KEY_F11 = 102
KEY_F12 = 103
KEY_CAPSLOCKTOGGLE = 104
KEY_NUMLOCKTOGGLE = 105
KEY_SCROLLLOCKTOGGLE = 106
KEY_LAST = 106
MOUSE_FIRST = 107
MOUSE_LEFT = 107
MOUSE_RIGHT = 108
MOUSE_MIDDLE = 109
MOUSE_4 = 110
MOUSE_5 = 111
MOUSE_WHEEL_UP = 112
MOUSE_WHEEL_DOWN = 113
MOUSE_LAST = 113
JOYSTICK_FIRST = 114
JOYSTICK_FIRST_BUTTON = 114
JOYSTICK_LAST_BUTTON = 145
JOYSTICK_FIRST_POV_BUTTON = 146
JOYSTICK_LAST_POV_BUTTON = 149
JOYSTICK_FIRST_AXIS_BUTTON = 150
JOYSTICK_LAST_AXIS_BUTTON = 161
JOYSTICK_LAST = 161
}
enum AnalogCode
{
MOUSE_X = 0
MOUSE_Y = 1
MOUSE_XY = 2
MOUSE_WHEEL = 3
JOYSTICK_FIRST_AXIS = 4
JOYSTICK_LAST_AXIS = 9
}
enum CursorCode
{
dc_none = 1
dc_arrow = 2
dc_ibeam = 3
dc_hourglass = 4
dc_waitarrow = 5
dc_crosshair = 6
dc_up = 7
dc_sizenwse = 8
dc_sizenesw = 9
dc_sizewe = 10
dc_sizens = 11
dc_sizeall = 12
dc_no = 13
dc_hand = 14
dc_blank = 15
}
enum Alignment
{
northwest = 0
north = 1
northeast = 2
west = 3
center = 4
east = 5
southwest = 6
south = 7
southeast = 8
}
if ( __Documentation.RegisterHelp != dummy )
{
local RegEnum = function( e )
{
local K = getconsttable()[e];
__Documentation.RegisterEnumHelp( e, K.len(), "" );
e += ".";
foreach ( s, v in K )
{
__Documentation.RegisterConstHelp( e+s, v, "" );
}
}
RegEnum( "ButtonCode" );
RegEnum( "AnalogCode" );
RegEnum( "CursorCode" );
RegEnum( "Alignment" );
__Documentation.RegisterHelp( "ISurface::CreateFont", "void ISurface::CreateFont(string, handle)", "" );
__Documentation.RegisterHelp( "IVGui::CreatePanel", "handle IVGui::CreatePanel(string, handle, string)", "" );
__Documentation.RegisterHelp( "IVGui::GetRootPanel", "handle IVGui::GetRootPanel()", "" );
__Documentation.RegisterHelp( "IVGui::GetClientDLLRootPanel", "handle IVGui::GetClientDLLRootPanel()", "" );
__Documentation.RegisterHelp( "IVGui::GetHudViewport", "handle IVGui::GetHudViewport()", "" );
}
)script";

View File

@ -447,6 +447,8 @@ void CHudMessage::MessageScanStart( void )
break;
}
// Font was just set in MessageDrawScan()
#ifndef MAPBASE
m_parms.font = g_hFontTrebuchet24;
if ( m_parms.vguiFontName != NULL &&
@ -455,6 +457,7 @@ void CHudMessage::MessageScanStart( void )
SetFont( vgui::scheme()->GetDefaultScheme(), m_parms.vguiFontName );
}
#endif
}
//-----------------------------------------------------------------------------
@ -497,7 +500,30 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
m_parms.totalWidth = 0;
m_parms.vguiFontName = pMessage->pVGuiSchemeFontName;
#ifdef MAPBASE
if ( m_parms.vguiFontName != NULL &&
m_parms.vguiFontName[ 0 ] )
{
SetFont( vgui::scheme()->GetDefaultScheme(), m_parms.vguiFontName );
#ifdef MAPBASE_VSCRIPT
if ( m_parms.font == vgui::INVALID_FONT )
{
extern vgui::HFont GetScriptFont( const char *, bool );
vgui::HFont font = GetScriptFont( m_parms.vguiFontName, IsProportional() );
textmessage->SetFont( font );
m_parms.font = font;
}
#endif
}
else
{
m_parms.font = g_hFontTrebuchet24;
}
#else
m_parms.font = g_hFontTrebuchet24;
#endif
while ( *pText )
{

View File

@ -234,14 +234,6 @@ CPanelMetaClassMgrImp::CPanelMetaClassMgrImp() : m_PanelTypeDict( true, 0, 32 )
CPanelMetaClassMgrImp::~CPanelMetaClassMgrImp()
{
#ifdef MAPBASE // VDC Memory Leak Fixes
while (m_MetaClassKeyValues.Count()>0)
{
if (m_MetaClassKeyValues[0])
m_MetaClassKeyValues[0]->deleteThis();
m_MetaClassKeyValues.RemoveAt(0);
}
#endif
}

View File

@ -146,6 +146,8 @@ CParticleEffectBinding::CParticleEffectBinding()
m_LastMin = m_Min;
m_LastMax = m_Max;
m_flParticleCullRadius = 0.0f;
SetParticleCullRadius( 0.0f );
m_nActiveParticles = 0;

View File

@ -119,7 +119,7 @@ entities. Each one is useful under different conditions.
#include "tier0/fasttimer.h"
#include "utllinkedlist.h"
#include "utldict.h"
#ifdef WIN32
#if defined(WIN32) && _MSC_VER < 1900
#include <typeinfo.h>
#else
#include <typeinfo>

View File

@ -6,7 +6,7 @@
//=============================================================================//
#include "cbase.h"
#include "c_baseentity.h"
#ifdef WIN32
#if defined(WIN32) && _MSC_VER < 1900
#include <typeinfo.h>
#endif
#include "tier0/vprof.h"

View File

@ -704,9 +704,157 @@ void C_PhysPropClientside::ParseAllEntities(const char *pMapData)
}
}
#ifdef MAPBASE
CBaseAnimating *BreakModelCreate_Ragdoll( CBaseEntity *pOwnerEnt, breakmodel_t *pModel, const Vector &position, const QAngle &angles, const Vector &velocity, const AngularImpulse &angVelocity )
{
C_BaseAnimating *pOwner = dynamic_cast<C_BaseAnimating *>( pOwnerEnt );
if ( !pOwner )
return NULL;
C_ClientRagdoll *pRagdoll = new C_ClientRagdoll( false );
if ( pRagdoll == NULL )
return NULL;
const char *pModelName = pModel->modelName;
if ( pRagdoll->InitializeAsClientEntity( pModelName, RENDER_GROUP_OPAQUE_ENTITY ) == false )
{
pRagdoll->Release();
return NULL;
}
pRagdoll->SetAbsOrigin( position );
pRagdoll->SetAbsAngles( angles );
matrix3x4_t boneDelta0[MAXSTUDIOBONES];
matrix3x4_t boneDelta1[MAXSTUDIOBONES];
matrix3x4_t currentBones[MAXSTUDIOBONES];
const float boneDt = 0.1f;
pRagdoll->SetParent( pOwner );
pRagdoll->ForceSetupBonesAtTime( boneDelta0, gpGlobals->curtime - boneDt );
pRagdoll->ForceSetupBonesAtTime( boneDelta1, gpGlobals->curtime );
pRagdoll->ForceSetupBonesAtTime( currentBones, gpGlobals->curtime );
pRagdoll->SetParent( NULL );
// We need to take these from the entity
//pRagdoll->SetAbsOrigin( position );
//pRagdoll->SetAbsAngles( angles );
pRagdoll->IgniteRagdoll( pOwner );
pRagdoll->TransferDissolveFrom( pOwner );
pRagdoll->InitModelEffects();
if ( pOwner->IsEffectActive( EF_NOSHADOW ) )
{
pRagdoll->AddEffects( EF_NOSHADOW );
}
pRagdoll->m_nRenderFX = kRenderFxRagdoll;
pRagdoll->SetRenderMode( pOwner->GetRenderMode() );
pRagdoll->SetRenderColor( pOwner->GetRenderColor().r, pOwner->GetRenderColor().g, pOwner->GetRenderColor().b, pOwner->GetRenderColor().a );
//pRagdoll->SetGlobalFadeScale( pOwner->GetGlobalFadeScale() );
pRagdoll->SetSkin( pOwner->GetSkin() );
//pRagdoll->m_vecForce = pOwner->m_vecForce;
//pRagdoll->m_nForceBone = 0; //pOwner->m_nForceBone;
pRagdoll->SetNextClientThink( CLIENT_THINK_ALWAYS );
pRagdoll->SetModelName( AllocPooledString( pModelName ) );
pRagdoll->ResetSequence( 0 );
pRagdoll->SetModelScale( pOwner->GetModelScale() );
pRagdoll->SetCollisionGroup( COLLISION_GROUP_DEBRIS );
//pRagdoll->m_builtRagdoll = true;
CStudioHdr *hdr = pRagdoll->GetModelPtr();
if ( !hdr )
{
pRagdoll->Release();
Warning( "Couldn't create ragdoll gib for %s (no model pointer)\n", pModel->modelName );
return NULL;
}
pRagdoll->m_pRagdoll = CreateRagdoll(
pRagdoll,
hdr,
vec3_origin,
0,
boneDelta0,
boneDelta1,
currentBones,
boneDt );
if ( !pRagdoll->m_pRagdoll )
{
pRagdoll->Release();
Warning( "Couldn't create ragdoll gib for %s\n", pModel->modelName );
return NULL;
}
IPhysicsObject *pPhysicsObject = pRagdoll->VPhysicsGetObject();
if ( pPhysicsObject )
{
// randomize velocity by 5%
float rndf = RandomFloat( -0.025, 0.025 );
Vector rndVel = velocity + rndf*velocity;
pPhysicsObject->AddVelocity( &rndVel, &angVelocity );
}
pRagdoll->ApplyLocalAngularVelocityImpulse( angVelocity );
if ( pRagdoll->m_pRagdoll )
{
pRagdoll->m_bImportant = false;
pRagdoll->m_flForcedRetireTime = pModel->fadeTime > 0.0f ? gpGlobals->curtime + pModel->fadeTime : 0.0f;
s_RagdollLRU.MoveToTopOfLRU( pRagdoll, pRagdoll->m_bImportant, pRagdoll->m_flForcedRetireTime );
pRagdoll->m_bFadeOut = true;
}
// Cause the entity to recompute its shadow type and make a
// version which only updates when physics state changes
// NOTE: We have to do this after m_pRagdoll is assigned above
// because that's what ShadowCastType uses to figure out which type of shadow to use.
pRagdoll->DestroyShadow();
pRagdoll->CreateShadow();
pRagdoll->SetAbsOrigin( position );
pRagdoll->SetAbsAngles( angles );
pRagdoll->SetPlaybackRate( 0 );
pRagdoll->SetCycle( 0 );
// put into ACT_DIERAGDOLL if it exists, otherwise use sequence 0
int nSequence = pRagdoll->SelectWeightedSequence( ACT_DIERAGDOLL );
if ( nSequence < 0 )
{
pRagdoll->ResetSequence( 0 );
}
else
{
pRagdoll->ResetSequence( nSequence );
}
pRagdoll->UpdatePartitionListEntry();
pRagdoll->MarkRenderHandleDirty();
NoteRagdollCreationTick( pRagdoll );
//pRagdoll->InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt );
return pRagdoll;
}
#endif
CBaseEntity *BreakModelCreateSingle( CBaseEntity *pOwner, breakmodel_t *pModel, const Vector &position,
const QAngle &angles, const Vector &velocity, const AngularImpulse &angVelocity, int nSkin, const breakablepropparams_t &params )
{
#ifdef MAPBASE
if ( pModel->isRagdoll )
{
CBaseEntity *pEntity = BreakModelCreate_Ragdoll( pOwner, pModel, position, angles, velocity, angVelocity );
return pEntity;
}
#endif
C_PhysPropClientside *pEntity = C_PhysPropClientside::CreateNew();
if ( !pEntity )
@ -778,10 +926,12 @@ CBaseEntity *BreakModelCreateSingle( CBaseEntity *pOwner, breakmodel_t *pModel,
pEntity->SetFadeMinMax( pModel->fadeMinDist, pModel->fadeMaxDist );
}
#ifndef MAPBASE
if ( pModel->isRagdoll )
{
DevMsg( "BreakModelCreateSingle: clientside doesn't support ragdoll breakmodels.\n" );
}
#endif
IPhysicsObject *pPhysicsObject = pEntity->VPhysicsGetObject();

View File

@ -855,7 +855,7 @@ void CPrediction::RunCommand( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper
C_BaseCombatWeapon *weapon = dynamic_cast< C_BaseCombatWeapon * >( CBaseEntity::Instance( ucmd->weaponselect ) );
if ( weapon )
{
player->SelectItem( weapon->GetName(), ucmd->weaponsubtype );
player->SelectItem( weapon->GetClassname(), ucmd->weaponsubtype );
}
}

View File

@ -12,6 +12,9 @@
#include "materialsystem/imaterialsystem.h"
#include "functionproxy.h"
#include "toolframework_client.h"
#ifdef MAPBASE
#include "view.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@ -522,3 +525,99 @@ void CPlayerLogoOnModelProxy::OnBind( void *pC_BaseEntity )
EXPOSE_INTERFACE( CPlayerLogoOnModelProxy, IMaterialProxy, "PlayerLogoOnModel" IMATERIAL_PROXY_INTERFACE_VERSION );
*/
#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Returns the proximity of the current view to the entity
//-----------------------------------------------------------------------------
class CViewProximityProxy : public CResultProxy
{
public:
bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
void OnBind( void *pC_BaseEntity );
private:
float m_Factor;
};
bool CViewProximityProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
if (!CResultProxy::Init( pMaterial, pKeyValues ))
return false;
m_Factor = pKeyValues->GetFloat( "scale", 0.002 );
return true;
}
void CViewProximityProxy::OnBind( void *pC_BaseEntity )
{
if (!pC_BaseEntity)
return;
// Find the distance between the player and this entity....
C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );
Vector delta;
VectorSubtract( pEntity->WorldSpaceCenter(), CurrentViewOrigin(), delta );
Assert( m_pResult );
SetFloatResult( delta.Length() * m_Factor );
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
EXPOSE_INTERFACE( CViewProximityProxy, IMaterialProxy, "ViewProximity" IMATERIAL_PROXY_INTERFACE_VERSION );
//-----------------------------------------------------------------------------
// Returns the current view direction
//-----------------------------------------------------------------------------
class CViewDirectionProxy : public CResultProxy
{
public:
bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
void OnBind( void *pC_BaseEntity );
private:
float m_Factor;
};
bool CViewDirectionProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
{
if (!CResultProxy::Init( pMaterial, pKeyValues ))
return false;
m_Factor = pKeyValues->GetFloat( "scale", 2 );
return true;
}
void CViewDirectionProxy::OnBind( void *pC_BaseEntity )
{
if (!pC_BaseEntity)
return;
// Find the view angle between the player and this entity....
C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );
Vector delta;
Vector forward;
VectorSubtract( pEntity->WorldSpaceCenter(), CurrentViewOrigin(), delta );
VectorNormalize( delta );
forward = CurrentViewForward();
Assert( m_pResult );
SetFloatResult( DotProduct( forward, delta ) * m_Factor );
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
EXPOSE_INTERFACE( CViewDirectionProxy, IMaterialProxy, "ViewDirection" IMATERIAL_PROXY_INTERFACE_VERSION );
#endif

View File

@ -69,6 +69,16 @@ BEGIN_SIMPLE_DATADESC( CRagdoll )
DEFINE_RAGDOLL_ELEMENT( 21 ),
DEFINE_RAGDOLL_ELEMENT( 22 ),
DEFINE_RAGDOLL_ELEMENT( 23 ),
#ifdef MAPBASE
DEFINE_RAGDOLL_ELEMENT( 24 ),
DEFINE_RAGDOLL_ELEMENT( 25 ),
DEFINE_RAGDOLL_ELEMENT( 26 ),
DEFINE_RAGDOLL_ELEMENT( 27 ),
DEFINE_RAGDOLL_ELEMENT( 28 ),
DEFINE_RAGDOLL_ELEMENT( 29 ),
DEFINE_RAGDOLL_ELEMENT( 30 ),
DEFINE_RAGDOLL_ELEMENT( 31 ),
#endif
END_DATADESC()
@ -477,6 +487,9 @@ int C_ServerRagdoll::InternalDrawModel( int flags )
return ret;
}
#ifdef MAPBASE
static ConVar g_ragdoll_server_snatch_instance( "g_ragdoll_server_snatch_instance", "1", FCVAR_NONE, "Allows serverside ragdolls to snatch their source entities' model instances in the same way clientside ragdolls do, thereby retaining decals." );
#endif
CStudioHdr *C_ServerRagdoll::OnNewModel( void )
{
@ -499,6 +512,26 @@ CStudioHdr *C_ServerRagdoll::OnNewModel( void )
m_iv_ragAngles.SetMaxCount( m_elementCount );
}
#ifdef MAPBASE
if ( GetOwnerEntity() )
{
if (GetOwnerEntity()->GetModelName() == GetModelName())
{
// TODO: Is there a better place for this?
if (GetOwnerEntity()->GetBaseAnimating())
GetOwnerEntity()->GetBaseAnimating()->m_pServerRagdoll = this;
if (g_ragdoll_server_snatch_instance.GetBool())
{
GetOwnerEntity()->SnatchModelInstance( this );
}
}
}
// Add server ragdolls to the creation tick list
NoteRagdollCreationTick( this );
#endif
return hdr;
}

Some files were not shown because too many files have changed in this diff Show More