-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathcg_api.cpp
More file actions
674 lines (560 loc) · 17.5 KB
/
cg_api.cpp
File metadata and controls
674 lines (560 loc) · 17.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
/*
===========================================================================
Daemon BSD Source Code
Copyright (c) 2013-2016, Daemon Developers
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Daemon developers nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DAEMON DEVELOPERS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===========================================================================
*/
#include <engine/client/cg_msgdef.h>
#include <shared/VMMain.h>
#include <shared/CommandBufferClient.h>
#include "cg_api.h"
IPC::CommandBufferClient cmdBuffer("cgame");
// Definition of the VM->Engine calls
// All Miscs
void trap_SendClientCommand( const char *s )
{
VM::SendMsg<SendClientCommandMsg>(s);
}
void trap_UpdateScreen()
{
VM::SendMsg<UpdateScreenMsg>();
}
void trap_CM_BatchMarkFragments(
unsigned maxPoints, //per mark
unsigned maxFragments, //per mark
const std::vector<markMsgInput_t> &markMsgInput,
std::vector<markMsgOutput_t> &markMsgOutput )
{
if (!markMsgInput.empty())
{
VM::SendMsg<CMBatchMarkFragments>(maxPoints, maxFragments, markMsgInput, markMsgOutput);
}
}
void trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime )
{
VM::SendMsg<GetCurrentSnapshotNumberMsg>(*snapshotNumber, *serverTime);
}
bool trap_GetSnapshot( int snapshotNumber, ipcSnapshot_t *snapshot )
{
bool res;
VM::SendMsg<GetSnapshotMsg>(snapshotNumber, res, *snapshot);
return res;
}
int trap_GetCurrentCmdNumber()
{
int res;
VM::SendMsg<GetCurrentCmdNumberMsg>(res);
return res;
}
// Use a local cache to reduce IPC traffic. We assume that the user command number never decreases as
// the command number only resets on an svc_gamestate command, and this command is only sent once
// per cgame lifetime when the user enters the game (it's not even used for map_restart).
bool trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd )
{
static usercmd_t cache[ CMD_BACKUP ];
static int latestInCache = -1;
if ( cmdNumber <= latestInCache - CMD_BACKUP )
{
// Either the cgame is buggy and trying to request really old stuff, or there is some case
// of additional calls to CL_ClearState that I didn't know about. Reset the cache in case
// it's legit.
Log::Warn( "Unexpectedly old command number requested in trap_GetUserCmd" );
latestInCache = -1;
}
else if ( cmdNumber <= latestInCache )
{
*ucmd = cache[ cmdNumber & CMD_MASK ];
return true;
}
bool res;
VM::SendMsg<GetUserCmdMsg>(cmdNumber, res, *ucmd);
if ( res )
{
latestInCache = cmdNumber;
cache[ cmdNumber & CMD_MASK ] = *ucmd;
}
return res;
}
void trap_SetUserCmdValue( int stateValue, int flags, float sensitivityScale )
{
VM::SendMsg<SetUserCmdValueMsg>(stateValue, flags, sensitivityScale);
}
void trap_RegisterButtonCommands( const char *cmds )
{
VM::SendMsg<RegisterButtonCommandsMsg>(cmds);
}
void trap_notify_onTeamChange( int newTeam )
{
VM::SendMsg<NotifyTeamChangeMsg>(newTeam);
}
void trap_PrepareKeyUp()
{
VM::SendMsg<PrepareKeyUpMsg>();
}
void trap_DispatchRawData( const std::string& data ) {
VM::SendMsg<DispatchRawDataMsg>( data );
}
std::string trap_DispatchRawDataSync( const std::string& data ) {
std::string out;
VM::SendMsg<DispatchRawDataSyncMsg>( data, out );
return out;
}
// All Sounds
void trap_S_StartSound( vec3_t origin, int entityNum, soundChannel_t, sfxHandle_t sfx )
{
Vec3 myorigin = Vec3(0.0f, 0.0f, 0.0f);
if (origin) {
myorigin = Vec3::Load(origin);
}
cmdBuffer.SendMsg<Audio::StartSoundMsg>(!!origin, myorigin, entityNum, sfx);
}
void trap_S_StartLocalSound( sfxHandle_t sfx, soundChannel_t )
{
cmdBuffer.SendMsg<Audio::StartLocalSoundMsg>(sfx);
}
void trap_S_ClearLoopingSounds( bool )
{
cmdBuffer.SendMsg<Audio::ClearLoopingSoundsMsg>();
}
void trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx, bool persistent )
{
if (origin) {
trap_S_UpdateEntityPosition(entityNum, origin);
}
if (velocity) {
trap_S_UpdateEntityVelocity(entityNum, velocity);
}
cmdBuffer.SendMsg<Audio::AddLoopingSoundMsg>( entityNum, sfx, persistent );
}
void trap_S_StopLoopingSound( int entityNum )
{
cmdBuffer.SendMsg<Audio::StopLoopingSoundMsg>(entityNum);
}
void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin )
{
cmdBuffer.SendMsg<Audio::UpdateEntityPositionMsg>(entityNum, Vec3::Load(origin));
}
void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[ 3 ], int )
{
if (origin) {
trap_S_UpdateEntityPosition(entityNum, origin);
}
std::array<Vec3, 3> myaxis;
myaxis[0] = Vec3::Load(axis[0]);
myaxis[1] = Vec3::Load(axis[1]);
myaxis[2] = Vec3::Load(axis[2]);
cmdBuffer.SendMsg<Audio::RespatializeMsg>(entityNum, myaxis);
}
sfxHandle_t trap_S_RegisterSound( const char *sample, bool)
{
int sfx;
VM::SendMsg<Audio::RegisterSoundMsg>(sample, sfx);
return sfx;
}
void trap_S_StartBackgroundTrack( const char *intro, const char *loop )
{
cmdBuffer.SendMsg<Audio::StartBackgroundTrackMsg>(intro, loop);
}
void trap_S_StopBackgroundTrack()
{
cmdBuffer.SendMsg<Audio::StopBackgroundTrackMsg>();
}
void trap_S_UpdateEntityVelocity( int entityNum, const vec3_t velocity )
{
cmdBuffer.SendMsg<Audio::UpdateEntityVelocityMsg>(entityNum, Vec3::Load(velocity));
}
void trap_S_UpdateEntityPositionVelocity( int entityNum, const vec3_t origin, const vec3_t velocity )
{
cmdBuffer.SendMsg<Audio::UpdateEntityPositionVelocityMsg>(entityNum, Vec3::Load(origin), Vec3::Load(velocity));
}
void trap_S_SetReverb( int slotNum, const char* name, float ratio )
{
cmdBuffer.SendMsg<Audio::SetReverbMsg>(slotNum, name, ratio);
}
void trap_S_BeginRegistration( const int playerNum )
{
cmdBuffer.SendMsg<Audio::BeginRegistrationMsg>( playerNum );
}
void trap_S_EndRegistration()
{
cmdBuffer.SendMsg<Audio::EndRegistrationMsg>();
}
// All renderer
void trap_R_SetAltShaderTokens( const char *str )
{
VM::SendMsg<Render::SetAltShaderTokenMsg>(str);
}
void trap_R_GetShaderNameFromHandle( const qhandle_t shader, char *out, int len )
{
std::string result;
VM::SendMsg<Render::GetShaderNameFromHandleMsg>(shader, result);
Q_strncpyz(out, result.c_str(), len);
}
void trap_R_ScissorEnable( bool enable )
{
cmdBuffer.SendMsg<Render::ScissorEnableMsg>(enable);
}
void trap_R_ScissorSet( int x, int y, int w, int h )
{
cmdBuffer.SendMsg<Render::ScissorSetMsg>(x, y, w, h);
}
void trap_R_LoadWorldMap( const char *mapname )
{
VM::SendMsg<Render::LoadWorldMapMsg>(mapname);
}
qhandle_t trap_R_RegisterModel( const char *name )
{
int handle;
VM::SendMsg<Render::RegisterModelMsg>(name, handle);
return handle;
}
qhandle_t trap_R_RegisterSkin( const char *name )
{
int handle;
VM::SendMsg<Render::RegisterSkinMsg>(name, handle);
return handle;
}
qhandle_t trap_R_RegisterShader( const char *name, int flags )
{
int handle;
VM::SendMsg<Render::RegisterShaderMsg>(name, flags, handle);
return handle;
}
void trap_R_ClearScene()
{
cmdBuffer.SendMsg<Render::ClearSceneMsg>();
}
void trap_R_AddRefEntityToScene( const refEntity_t *re )
{
cmdBuffer.SendMsg<Render::AddRefEntityToSceneMsg>(*re);
}
void trap_R_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts )
{
if (!numVerts)
{
return;
}
std::vector<polyVert_t> myverts(verts, verts + numVerts);
cmdBuffer.SendMsg<Render::AddPolyToSceneMsg>(hShader, myverts);
}
void trap_R_AddPolysToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys )
{
size_t size = numVerts * numPolys;
if (!size)
{
return;
}
std::vector<polyVert_t> myverts(verts, verts + size);
cmdBuffer.SendMsg<Render::AddPolysToSceneMsg>(hShader, myverts, numVerts, numPolys);
}
void trap_R_Add2dPolysIndexedToScene( const polyVert_t* polys, int numPolys, const int* indexes, int numIndexes, int trans_x, int trans_y, qhandle_t shader )
{
if (!numIndexes)
{
return;
}
std::vector<polyVert_t> mypolys(polys, polys + numPolys);
std::vector<int> myindices(indexes, indexes + numIndexes);
cmdBuffer.SendMsg<Render::Add2dPolysIndexedMsg>(mypolys, numPolys, myindices, numIndexes, trans_x, trans_y, shader);
}
// Used exclusively for RmlUI's transformations. Other usecases might
// not work as expected.
void trap_R_SetMatrixTransform( const matrix_t matrix )
{
std::array<float, 16> mymatrix;
MatrixCopy(matrix, mymatrix.data());
cmdBuffer.SendMsg<Render::SetMatrixTransformMsg>(mymatrix);
}
// Used exclusively for RmlUI's transformations. Other usecases might
// not work as expected.
void trap_R_ResetMatrixTransform()
{
cmdBuffer.SendMsg<Render::ResetMatrixTransformMsg>();
}
void trap_R_AddLightToScene( const vec3_t origin, float radius, float intensity, float r, float g, float b, int flags )
{
std::array<float, 3> myorg;
VectorCopy( origin, myorg );
cmdBuffer.SendMsg<Render::AddLightToSceneMsg>(myorg, radius, r * intensity, g * intensity, b * intensity, flags);
}
void trap_R_RenderScene( const refdef_t *fd )
{
cmdBuffer.SendMsg<Render::RenderSceneMsg>(*fd);
}
void trap_R_ClearColor()
{
cmdBuffer.SendMsg<Render::SetColorMsg>(Color::White);
}
void trap_R_SetColor( const Color::Color &rgba )
{
cmdBuffer.SendMsg<Render::SetColorMsg>(rgba);
}
void trap_R_SetClipRegion( const float *region )
{
std::array<float, 4> myregion;
Vector4Copy(region, myregion);
cmdBuffer.SendMsg<Render::SetClipRegionMsg>(myregion);
}
void trap_R_ResetClipRegion()
{
cmdBuffer.SendMsg<Render::ResetClipRegionMsg>();
}
void trap_R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader )
{
cmdBuffer.SendMsg<Render::DrawStretchPicMsg>(x, y, w, h, s1, t1, s2, t2, hShader);
}
void trap_R_DrawRotatedPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader, float angle )
{
cmdBuffer.SendMsg<Render::DrawRotatedPicMsg>(x, y, w, h, s1, t1, s2, t2, hShader, angle);
}
void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs )
{
std::array<float, 3> mymins, mymaxs;
VM::SendMsg<Render::ModelBoundsMsg>(model, mymins, mymaxs);
VectorCopy(mymins, mins);
VectorCopy(mymaxs, maxs);
}
int trap_R_LerpTag( orientation_t *tag, const refEntity_t *refent, const char *tagName, int startIndex )
{
int result;
VM::SendMsg<Render::LerpTagMsg>(*refent, tagName, startIndex, *tag, result);
return result;
}
void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset )
{
VM::SendMsg<Render::RemapShaderMsg>(oldShader, newShader, timeOffset);
}
std::vector<bool> trap_R_BatchInPVS(
const vec3_t origin,
const std::vector<std::array<float, 3>>& posEntities )
{
std::array<float, 3> myOrigin;
VectorCopy(origin, myOrigin);
std::vector<bool> inPVS;
VM::SendMsg<Render::BatchInPVSMsg>(myOrigin, posEntities, inPVS);
return inPVS;
}
qhandle_t trap_R_RegisterAnimation( const char *name )
{
int handle;
VM::SendMsg<Render::RegisterAnimationMsg>(name, handle);
return handle;
}
int trap_R_BuildSkeleton( refSkeleton_t *skel, qhandle_t anim, int startFrame, int endFrame, float frac, bool clearOrigin )
{
int result;
VM::SendMsg<Render::BuildSkeletonMsg>(anim, startFrame, endFrame, frac, clearOrigin, *skel, result);
return result;
}
// Shamelessly stolen from tr_animation.cpp
int trap_R_BlendSkeleton( refSkeleton_t *skel, const refSkeleton_t *blend, float frac )
{
int i;
vec3_t bounds[ 2 ];
if ( skel->numBones != blend->numBones )
{
Log::Warn("trap_R_BlendSkeleton: different number of bones %d != %d", skel->numBones, blend->numBones);
return false;
}
// lerp between the 2 bone poses
for ( i = 0; i < skel->numBones; i++ )
{
transform_t trans;
TransStartLerp( &trans );
TransAddWeight( 1.0f - frac, &skel->bones[ i ].t, &trans );
TransAddWeight( frac, &blend->bones[ i ].t, &trans );
TransEndLerp( &trans );
skel->bones[ i ].t = trans;
}
// calculate a bounding box in the current coordinate system
for ( i = 0; i < 3; i++ )
{
bounds[ 0 ][ i ] = skel->bounds[ 0 ][ i ] < blend->bounds[ 0 ][ i ] ? skel->bounds[ 0 ][ i ] : blend->bounds[ 0 ][ i ];
bounds[ 1 ][ i ] = skel->bounds[ 1 ][ i ] > blend->bounds[ 1 ][ i ] ? skel->bounds[ 1 ][ i ] : blend->bounds[ 1 ][ i ];
}
VectorCopy( bounds[ 0 ], skel->bounds[ 0 ] );
VectorCopy( bounds[ 1 ], skel->bounds[ 1 ] );
return true;
}
int trap_R_BoneIndex( qhandle_t hModel, const char *boneName )
{
int index;
VM::SendMsg<Render::BoneIndexMsg>(hModel, boneName, index);
return index;
}
int trap_R_AnimNumFrames( qhandle_t hAnim )
{
int n;
VM::SendMsg<Render::AnimNumFramesMsg>(hAnim, n);
return n;
}
int trap_R_AnimFrameRate( qhandle_t hAnim )
{
int n;
VM::SendMsg<Render::AnimFrameRateMsg>(hAnim, n);
return n;
}
qhandle_t trap_RegisterVisTest()
{
int handle;
VM::SendMsg<Render::RegisterVisTestMsg>(handle);
return handle;
}
void trap_AddVisTestToScene( qhandle_t hTest, const vec3_t pos, float depthAdjust, float area )
{
std::array<float, 3> mypos;
VectorCopy(pos, mypos);
cmdBuffer.SendMsg<Render::AddVisTestToSceneMsg>(hTest, mypos, depthAdjust, area);
}
float trap_CheckVisibility( qhandle_t hTest )
{
float result;
VM::SendMsg<Render::CheckVisibilityMsg>(hTest, result);
return result;
}
void trap_R_GetTextureSize( qhandle_t handle, int *x, int *y )
{
VM::SendMsg<Render::GetTextureSizeMsg>(handle, *x, *y);
}
qhandle_t trap_R_GenerateTexture( const byte *data, int x, int y )
{
ASSERT( x && y );
qhandle_t handle;
std::vector<byte> mydata(data, data + 4 * x * y);
VM::SendMsg<Render::GenerateTextureMsg>(mydata, x, y, handle);
return handle;
}
void trap_UnregisterVisTest( qhandle_t hTest )
{
cmdBuffer.SendMsg<Render::UnregisterVisTestMsg>(hTest);
}
void trap_SetColorGrading( int slot, qhandle_t hShader )
{
cmdBuffer.SendMsg<Render::SetColorGradingMsg>(slot, hShader);
}
// All keys
int trap_Key_GetCatcher()
{
int result;
VM::SendMsg<Keyboard::GetCatcherMsg>(result);
return result;
}
void trap_Key_SetCatcher( int catcher )
{
VM::SendMsg<Keyboard::SetCatcherMsg>(catcher);
}
std::vector<std::vector<Keyboard::Key>> trap_Key_GetKeysForBinds(int team, const std::vector<std::string>& binds) {
std::vector<std::vector<Keyboard::Key>> result;
VM::SendMsg<Keyboard::GetKeysForBindsMsg>(team, binds, result);
return result;
}
int trap_Key_GetCharForScancode( int scancode )
{
int result;
VM::SendMsg<Keyboard::GetCharForScancodeMsg>(scancode, result);
return result;
}
void trap_Key_SetBinding( Keyboard::Key key, int team, const char *cmd )
{
VM::SendMsg<Keyboard::SetBindingMsg>(key, team, cmd);
}
std::vector<Keyboard::Key> trap_Key_GetConsoleKeys()
{
std::vector<Keyboard::Key> result;
VM::SendMsg<Keyboard::GetConsoleKeysMsg>(result);
return result;
}
void trap_Key_SetConsoleKeys(const std::vector<Keyboard::Key>& keys)
{
VM::SendMsg<Keyboard::SetConsoleKeysMsg>(keys);
}
void trap_Key_ClearCmdButtons()
{
VM::SendMsg<Keyboard::ClearCmdButtonsMsg>();
}
void trap_Key_ClearStates()
{
VM::SendMsg<Keyboard::ClearStatesMsg>();
}
std::vector<bool> trap_Key_KeysDown( const std::vector<Keyboard::Key>& keys )
{
std::vector<bool> list;
VM::SendMsg<Keyboard::KeysDownMsg>( keys, list );
return list;
}
// Mouse
void trap_SetMouseMode( MouseMode mode )
{
VM::SendMsg<Mouse::SetMouseMode>( mode );
}
// All LAN
int trap_LAN_GetServerCount( int source )
{
int count;
VM::SendMsg<LAN::GetServerCountMsg>(source, count);
return count;
}
// See SVC_Info() for the keys that are supposed to be available in `info`
void trap_LAN_GetServerInfo( int source, int n, trustedServerInfo_t &trustedInfo, std::string &info )
{
VM::SendMsg<LAN::GetServerInfoMsg>(source, n, trustedInfo, info);
}
int trap_LAN_GetServerPing( int source, int n )
{
int ping;
VM::SendMsg<LAN::GetServerPingMsg>(source, n, ping);
return ping;
}
void trap_LAN_MarkServerVisible( int source, int n, bool visible )
{
VM::SendMsg<LAN::MarkServerVisibleMsg>(source, n, visible);
}
int trap_LAN_ServerIsVisible( int source, int n )
{
bool visible;
VM::SendMsg<LAN::ServerIsVisibleMsg>(source, n, visible);
return visible;
}
bool trap_LAN_UpdateVisiblePings( int source )
{
bool res;
VM::SendMsg<LAN::UpdateVisiblePingsMsg>(source, res);
return res;
}
void trap_LAN_ResetPings( int n )
{
VM::SendMsg<LAN::ResetPingsMsg>(n);
}
int trap_LAN_ServerStatus( const char *serverAddress, char *serverStatus, int maxLen )
{
std::string status;
int res;
VM::SendMsg<LAN::ServerStatusMsg>(serverAddress, maxLen, status, res);
Q_strncpyz(serverStatus, status.c_str(), maxLen);
return res;
}
void trap_LAN_ResetServerStatus()
{
VM::SendMsg<LAN::ResetServerStatusMsg>();
}