Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapbase v7.2 #250

Merged
merged 113 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
5a0c406
Added an entity factory manager for custom weapons
Petercov Apr 16, 2022
7877953
Fixes
Petercov Apr 16, 2022
749f9ff
Finished parser for vscript weapon
Petercov Apr 17, 2022
332856e
Added factory for melee weapons
Petercov Apr 18, 2022
f58b599
Fixed custom weapon scripts on client
Petercov Apr 18, 2022
e771805
Readiness activities for custom melee weapon
Petercov Apr 18, 2022
ee46bc4
Fixes
Petercov Apr 18, 2022
179b7a5
Added factory for bullet-firing guns
Petercov Apr 19, 2022
13f422f
Fix issues
Petercov Apr 19, 2022
0ae65a5
Fix weapon selection
Petercov Apr 19, 2022
d871c6f
Add Mapbase file headers
Petercov Apr 19, 2022
fa41a32
Added a data cache to the custom weapons system
Petercov Apr 20, 2022
31cd394
More features for custom melee weapon
Petercov Apr 20, 2022
3701914
Fix
Petercov Apr 20, 2022
d3978db
Fixed custom gun not reseting zoom when holstered
Petercov Apr 22, 2022
9eae921
Merge pull request #14 from mapbase-source/develop
Crimson-X1 Sep 10, 2022
8e28451
Merge branch 'mapbase-source:develop' into develop
Crimson-X1 Oct 8, 2022
5e891f8
Update vscript_vgui
samisalreadytaken Nov 24, 2022
1aff4bb
Assert on concommand hook crash
samisalreadytaken Nov 26, 2022
f859131
Clarify comment
samisalreadytaken Dec 1, 2022
7011b89
Fix `CHudMessage::MessageDrawScan` ignoring custom font size
samisalreadytaken Dec 2, 2022
9e47b5a
Add vscript created custom font support on game_text (CHudMessage)
samisalreadytaken Dec 2, 2022
4a77eb2
Add vscript created font support on vgui_text_display
samisalreadytaken Dec 4, 2022
53d6ae6
Explicitly state header bit count in CNetMsgScriptHelper
samisalreadytaken Dec 27, 2022
f5837d0
Change vscript net message header size to 4 bytes from 2 bytes
samisalreadytaken Dec 27, 2022
783c8e8
Merge branch 'mapbase-source:develop' into develop
Crimson-X1 Dec 28, 2022
2d183a8
Add recursive KV read/write on CScriptKeyValues
samisalreadytaken Jan 5, 2023
3f2f562
Fix image rotation in vgui::ImagePanel
samisalreadytaken Jan 22, 2023
63a9dce
Disable vscript entity listeners on level shutdown
samisalreadytaken Jan 24, 2023
1724178
add mins and maxs to point_bugbait
arbabf Feb 19, 2023
54cd6f7
Fixed captions not loading from vpks
Petercov Aug 5, 2022
e672c35
Fixed missing some closecaptions
Petercov Sep 30, 2022
b5deefa
Fixed delayed closed captions
Petercov Feb 20, 2023
1ff5d61
Add new inputs for the new functionality
arbabf Feb 20, 2023
ebe9a8e
Fixed HL1 style lipsync
Petercov Feb 24, 2023
f4c2cb4
Fix vgui_controls not working outside of client.dll
Blixibon Mar 31, 2023
f8d3bea
Initial commit
Crimson-X1 Apr 3, 2023
1876d1a
Properly assign held physcannon entity to pass into commander goal trace
AgentAgrimar May 15, 2023
cbb119b
Fix ViewPunch random for AR2
Mr0maks Aug 25, 2023
2fe3adf
Fixed warnings about conversions between soundlevel_t and float
Mechami Sep 24, 2023
6915787
Merge pull request #183 from Petercov/mapbase-feature/custom-weapons
Blixibon Oct 25, 2023
9591e92
Merge pull request #217 from samisalreadytaken/vscript_vgui-patch
Blixibon Oct 25, 2023
8c33815
Fix existing point_bugbaits not using radius
Blixibon Oct 25, 2023
8729beb
Swap clientside weapon precache back to fix ammo not showing up corre…
Blixibon Oct 25, 2023
75e39c3
Fix Linux compile for custom weapons
Blixibon Oct 25, 2023
68ea86e
Merge pull request #229 from arbabf/develop
Blixibon Oct 25, 2023
323f9fc
Merge pull request #230 from Petercov/mapbase-feature/caption-fixes
Blixibon Oct 25, 2023
9e6035b
Merge pull request #231 from Petercov/mapbase-feature/hl1-mouth-fix
Blixibon Oct 25, 2023
8280197
Merge pull request #237 from AgentAgrimar/master
Blixibon Oct 25, 2023
8e9020c
Merge pull request #245 from Mr0maks/fix_random_in_ar2
Blixibon Oct 25, 2023
c406a67
Fix ViewPunch random for singleplayer AR2
Blixibon Oct 25, 2023
db1b687
Merge pull request #248 from Mechami/misc_conversion_fixes
Blixibon Oct 25, 2023
715acf4
Apply suggestions from code review
Blixibon Oct 25, 2023
c3f0509
Merge pull request #236 from Crimson-X1/feature/prop_sprinting
Blixibon Oct 25, 2023
bdef834
Fix mapspawn_addon not loading from VPK paths
Blixibon Oct 25, 2023
8194d80
Fix typo in logic_branch removal signal for logic_branch_listener
Blixibon Oct 25, 2023
cae8a7d
AI grenade throw hints
Blixibon Nov 3, 2023
d18b5a2
Fix clientside C_BaseCombatCharacter hierarchy in VScript
Blixibon Nov 3, 2023
032cfda
New Get/SetGroundEntity, Get/SetModelScale functions for VScript
Blixibon Nov 3, 2023
aa03b6b
Fix custom procedural crash
Blixibon Nov 3, 2023
0e110b7
Fix ai_relationship_classify applying before default relationships lo…
Blixibon Nov 3, 2023
c6ee153
Fix CBaseEntity::CanBeHitByMeleeAttack() not blocking damage from CTr…
Blixibon Nov 3, 2023
d981f6a
Fix Linux compile for AI grenade hints
Blixibon Nov 4, 2023
ecb58e4
Fix game_text and logic_format not functioning properly on Linux
Blixibon Oct 25, 2023
650ddee
Minor Mapbase workflow fixes
Blixibon Oct 31, 2023
e7cdb69
Fix ai_relationship_classify not working properly after loading save
Blixibon Nov 24, 2023
424fcf0
Add extra trace to npc_create for NPCs which should use bbox instead …
Blixibon Nov 24, 2023
5fe4621
Various comment changes
Blixibon Nov 24, 2023
6a0a015
SetClassRelationship function for VScript
Blixibon Nov 24, 2023
a131bf4
Fix unarmed citizens not picking up weapons from racks
Blixibon Nov 24, 2023
5de0ee4
Fix a few syntax mistakes involving bool functions returning NULL
Blixibon Nov 24, 2023
e34e0d3
Updated README
Blixibon Nov 24, 2023
b97a58e
Add optional upwards viewkick to HL2 weapon_pistol
Blixibon Dec 17, 2023
e44f60e
Add new VScript and particle anim events
Blixibon Jan 3, 2024
0d37ded
Add OnScriptEvent outputs to ai_hint
Blixibon Jan 3, 2024
fd149ff
Add new dynamic interaction keyvalues and utilities
Blixibon Jan 3, 2024
a88091a
Enhancements for interactions which don't test angles (including a ne…
Blixibon Jan 3, 2024
869ec6d
Improved debugging for dynamic interaction distance
Blixibon Jan 3, 2024
dc8fe60
Fix dynamic interaction problems caused by walkframe sequence movement
Blixibon Jan 3, 2024
5910394
Fixes and hacks for HL2 NPCs performing dynamic interactions
Blixibon Jan 3, 2024
959332b
Fix related interactions having greater delays stomped out
Blixibon Jan 3, 2024
3861c6a
Fix semicolon
Blixibon Jan 3, 2024
85c1f7d
Add new response concepts + port several Alyx concepts for companion …
Blixibon Jan 3, 2024
9070d9a
Optional support for fired bullets notifying targets (currently only …
Blixibon Jan 3, 2024
a2a4aa3
Add additional enemy criteria to NPC speech
Blixibon Jan 3, 2024
3ce8a35
Add func_tank behavior criteria
Blixibon Jan 3, 2024
e1c890a
New response context-based check for TLK_SPOTTED_HEADCRAB_LEAVING_ZOM…
Blixibon Jan 5, 2024
7c5c90e
Fix TLK_NEW_ENEMY not playing on headcrabs or zombies
Blixibon Jan 5, 2024
1467557
Fix "their_" misc criteria not being registered
Blixibon Jan 5, 2024
06b27ac
Fix CNPC_BaseZombie::HeadcrabFits() and blood impacts not working wit…
Blixibon Jan 5, 2024
8b7c695
Fix AE_ZOMBIE_POPHEADCRAB using inaccurate headcrab release position
Blixibon Jan 5, 2024
a3fe8b5
Add cvar to prevent zombies from flinching during actbusies and scrip…
Blixibon Jan 5, 2024
4e7814e
Fix function call being in the wrong place
Blixibon Jan 5, 2024
a96147a
Add command line parameter to allow VScript file read paths with dot …
Blixibon Jan 5, 2024
4adab15
Add better circumstantial criteria to followup responses
Blixibon Jan 6, 2024
5afe4fa
Merge branch 'master' into develop
Blixibon Jan 11, 2024
19702d0
Fix weapon_custom_scripted ItemPreFrame base call
samisalreadytaken Jan 26, 2024
a02f3db
Fix weapon_custom_scripted hook calls
samisalreadytaken Jan 26, 2024
976eb23
Add vscript funcs
samisalreadytaken Nov 3, 2023
a6f9d0a
Fix CBaseEntity::ScriptGetKeyValue() returning cached string on inval…
samisalreadytaken Dec 5, 2023
f1123ed
Tidy up CSimpleCallChainer::PostScriptExecute()
samisalreadytaken Feb 2, 2024
de01ce6
Merge pull request #261 from samisalreadytaken/dev
Blixibon Feb 4, 2024
8505ab4
Merge pull request #262 from Blixibon/mapbase/feature/hl2-pistol-upwa…
Blixibon Feb 4, 2024
47ddedb
Merge pull request #269 from Blixibon/mapbase/feature/anim-event-impr…
Blixibon Feb 4, 2024
4cea5d1
Merge pull request #270 from Blixibon/mapbase/feature/dynamic-interac…
Blixibon Feb 4, 2024
4c2823e
Merge pull request #271 from Blixibon/mapbase/feature/new-companion-n…
Blixibon Feb 4, 2024
4e3f58f
Merge pull request #272 from Blixibon/mapbase/feature/zombie-serversi…
Blixibon Feb 4, 2024
782053e
Merge pull request #273 from Blixibon/mapbase/feature/zombie-no-flinc…
Blixibon Feb 4, 2024
11533fa
Merge pull request #274 from Blixibon/mapbase/feature/dot-slash-comma…
Blixibon Feb 4, 2024
02f8109
Merge pull request #275 from Blixibon/mapbase/feature/response-follow…
Blixibon Feb 4, 2024
f8d8cf6
Merge pull request #279 from samisalreadytaken/fix-weapon_custom_scri…
Blixibon Feb 4, 2024
8f7b707
Updated README
Blixibon Feb 5, 2024
6bd9bcb
Increment version numbers to v7.2
Blixibon Feb 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mapbase_build-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Add MSBuild to PATH
uses: microsoft/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/mapbase_build-sp-games.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
branches:
- develop
paths:
- '.github/workflows/mapbase_build-base.yml'
- '.github/workflows/mapbase_build-sp-rel-games.yml'
- 'sp/src/vpc_scripts/**'
- 'sp/src/game/**'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mapbase_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
# https://github.com/actions/labeler

name: Pull Request Automation
on: [pull_request]
on: [pull_request] # pull_request_target

jobs:
label:

if: github.repository_owner == 'mapbase-source'
if: github.repository_owner == 'mapbase-source' # ${{ vars.MAPBASE_LABELS == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
14 changes: 13 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//=========================================================================================================================

Mapbase v7.1 - Source 2013
Mapbase v7.2 - Source 2013
https://github.com/mapbase-source/source-sdk-2013
https://www.moddb.com/mods/mapbase

Expand Down Expand Up @@ -112,6 +112,12 @@ Direct contributions:
- 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/mapbase-game-src/pull/1 (Advanced video options duplicate field name 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 Rykah (Textures created by Blixibon; This is asset-based and, aside from the SLAM crate, not reflected in the code)
Expand All @@ -137,6 +143,9 @@ Direct contributions:
=-- 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/261 (Misc VScript additions)
=-- https://github.com/mapbase-source/source-sdk-2013/pull/279 (weapon_custom_scripted fixes)

== Contributions from z33ky:
=-- https://github.com/mapbase-source/source-sdk-2013/pull/21 (Various GCC/Linux compilation fixes)
Expand All @@ -156,6 +165,9 @@ Direct contributions:
=-- 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)

//-------------------------------------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion mp/src/game/shared/hl2mp/weapon_ar2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
102 changes: 102 additions & 0 deletions sp/src/game/client/c_baseanimating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4042,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;
Expand Down Expand Up @@ -4291,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;
}
Expand Down
2 changes: 1 addition & 1 deletion sp/src/game/client/c_basecombatcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ END_PREDICTION_DATA()

#ifdef MAPBASE_VSCRIPT

BEGIN_ENT_SCRIPTDESC( C_BaseCombatCharacter, CBaseEntity, "" )
BEGIN_ENT_SCRIPTDESC( C_BaseCombatCharacter, C_BaseAnimating, "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAmmoCount, "GetAmmoCount", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetActiveWeapon, "GetActiveWeapon", "" )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetWeapon, "GetWeapon", "" )
Expand Down
3 changes: 3 additions & 0 deletions sp/src/game/client/c_baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,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" )
Expand Down
5 changes: 5 additions & 0 deletions sp/src/game/client/c_baseentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ class C_BaseEntity : public IClientEntity
HSCRIPT GetScriptOwnerEntity();
virtual void SetScriptOwnerEntity(HSCRIPT pOwner);

#ifdef MAPBASE_VSCRIPT
HSCRIPT ScriptGetGroundEntity();
void ScriptSetGroundEntity( HSCRIPT hGroundEnt );
#endif

HSCRIPT GetScriptInstance();

HSCRIPT m_hScriptInstance;
Expand Down
1 change: 1 addition & 0 deletions sp/src/game/client/client_mapbase.vpc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ $Project
$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"
}

Expand Down
92 changes: 85 additions & 7 deletions sp/src/game/client/hud_closecaption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1496,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 )
{
Expand Down Expand Up @@ -1532,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.
Expand All @@ -1541,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 );
}
}
Expand Down Expand Up @@ -1569,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" ) )
{
Expand All @@ -1579,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 );
}
Expand Down Expand Up @@ -2614,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, ";" ) )
{
Expand All @@ -2626,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() )
{
Expand Down Expand Up @@ -2692,8 +2771,7 @@ void CHudCloseCaption::AddAdditionalCaptionDictionary( const char *dbfile, CUtlV
}

char fullpath[MAX_PATH];
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", path, dbfile );
Q_FixSlashes( fullpath );
V_ComposeFileName(path, dbfile, fullpath, sizeof(fullpath));

if ( IsX360() )
{
Expand Down
Loading
Loading