1313#include " ivieweffects.h"
1414#include " shake.h"
1515#include " eventlist.h"
16+ #ifdef MAPBASE
17+ #include " mapentities_shared.h"
18+ #endif
1619// NVNT haptic include for notification of world precache
1720#include " haptics/haptic_utils.h"
1821// memdbgon must be the last include file in a .cpp file!!!
@@ -62,9 +65,6 @@ BEGIN_RECV_TABLE( C_World, DT_World )
6265#ifdef MAPBASE
6366 RecvPropString (RECVINFO (m_iszChapterTitle)),
6467#endif
65- #ifdef MAPBASE_VSCRIPT
66- RecvPropInt (RECVINFO (m_iScriptLanguageClient)),
67- #endif
6868END_RECV_TABLE ()
6969
7070#ifdef MAPBASE_VSCRIPT
@@ -86,6 +86,11 @@ bool C_World::Init( int entnum, int iSerialNum )
8686 ActivityList_Init ();
8787 EventList_Init ();
8888
89+ #ifdef MAPBASE_VSCRIPT
90+ m_iScriptLanguageServer = SL_NONE ;
91+ m_iScriptLanguageClient = SL_NONE ;
92+ #endif
93+
8994 return BaseClass::Init ( entnum, iSerialNum );
9095}
9196
@@ -129,11 +134,6 @@ void C_World::OnDataChanged( DataUpdateType_t updateType )
129134 engine->SetOcclusionParameters ( params );
130135
131136 modelinfo->SetLevelScreenFadeRange ( m_flMinPropScreenSpaceWidth, m_flMaxPropScreenSpaceWidth );
132-
133- #ifdef MAPBASE_VSCRIPT
134- // This is now here so that C_World has time to receive the selected script language
135- VScriptClientInit ();
136- #endif
137137 }
138138}
139139
@@ -199,6 +199,72 @@ void C_World::Spawn( void )
199199 Precache ();
200200}
201201
202+ // -----------------------------------------------------------------------------
203+ // Parse data from a map file
204+ // -----------------------------------------------------------------------------
205+ bool C_World::KeyValue ( const char *szKeyName, const char *szValue )
206+ {
207+ #ifdef MAPBASE_VSCRIPT
208+ if ( FStrEq ( szKeyName, " vscriptlanguage" ) )
209+ {
210+ m_iScriptLanguageServer = atoi ( szValue );
211+ }
212+ else if ( FStrEq ( szKeyName, " vscriptlanguage_client" ) )
213+ {
214+ m_iScriptLanguageClient = atoi ( szValue );
215+ }
216+ else
217+ #endif
218+ return BaseClass::KeyValue ( szKeyName, szValue );
219+
220+ return true ;
221+ }
222+
223+ #ifdef MAPBASE
224+ // -----------------------------------------------------------------------------
225+ // Parses worldspawn data from BSP on the client
226+ // -----------------------------------------------------------------------------
227+ void C_World::ParseWorldMapData ( const char *pMapData )
228+ {
229+ char szTokenBuffer[MAPKEY_MAXLENGTH ];
230+ for ( ; true ; pMapData = MapEntity_SkipToNextEntity (pMapData, szTokenBuffer) )
231+ {
232+ //
233+ // Parse the opening brace.
234+ //
235+ char token[MAPKEY_MAXLENGTH ];
236+ pMapData = MapEntity_ParseToken ( pMapData, token );
237+
238+ //
239+ // Check to see if we've finished or not.
240+ //
241+ if (!pMapData)
242+ break ;
243+
244+ if (token[0 ] != ' {' )
245+ {
246+ Error ( " MapEntity_ParseAllEntities: found %s when expecting {" , token);
247+ continue ;
248+ }
249+
250+ CEntityMapData entData ( (char *)pMapData );
251+ char className[MAPKEY_MAXLENGTH ];
252+
253+ if (!entData.ExtractValue ( " classname" , className ))
254+ {
255+ Error ( " classname missing from entity!\n " );
256+ }
257+
258+ if ( !Q_strcmp ( className, " worldspawn" ) )
259+ {
260+ // Set up keyvalues.
261+ ParseMapData ( &entData );
262+ return ;
263+ }
264+ }
265+ }
266+ #endif
267+
202268
203269
204270C_World *GetClientWorldEntity ()
0 commit comments