本文整理汇总了C++中CM_TransformedPointContents函数的典型用法代码示例。如果您正苦于以下问题:C++ CM_TransformedPointContents函数的具体用法?C++ CM_TransformedPointContents怎么用?C++ CM_TransformedPointContents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CM_TransformedPointContents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SV_PointContents
int SV_PointContents(const CVec3 &p)
{
guard(SV_PointContents);
// get base contents from world
unsigned contents = CM_PointContents(p, 0);
contents |= CM_PointModelContents(p);
edict_t *list[MAX_EDICTS];
int num = SV_AreaEdicts(p, p, ARRAY_ARG(list), AREA_SOLID);
for (int i = 0; i < num; i++)
{
edict_t *edict = list[i];
entityHull_t &ent = ents[NUM_FOR_EDICT(edict)];
if (ent.model)
contents |= CM_TransformedPointContents(p, ent.model->headnode, edict->s.origin, ent.axis);
else
contents |= CM_TransformedPointContents(p, CM_HeadnodeForBox(ent.bounds), edict->s.origin, nullVec3);
}
return contents;
unguard;
}
示例2: SV_PointContents
/*
=======================================================================================================================================
SV_PointContents
=======================================================================================================================================
*/
int SV_PointContents(const vec3_t p, int passEntityNum) {
int touch[MAX_GENTITIES];
sharedEntity_t *hit;
int i, num;
int contents, c2;
clipHandle_t clipHandle;
// get base contents from world
contents = CM_PointContents(p, 0);
// or in contents from all the other entities
num = SV_AreaEntities(p, p, touch, MAX_GENTITIES);
for (i = 0; i < num; i++) {
if (touch[i] == passEntityNum) {
continue;
}
hit = SV_GentityNum(touch[i]);
// might intersect, so do an exact clip
clipHandle = SV_ClipHandleForEntity(hit);
// non - worldspawn entities must not use world as clip model!
if (clipHandle == 0) {
continue;
}
c2 = CM_TransformedPointContents(p, clipHandle, hit->r.currentOrigin, hit->r.currentAngles);
// s.origin/angles is base origin/angles, need to use the current origin/angles for moving entity based water, or water locks in movement start position.
//c2 = CM_TransformedPointContents(p, clipHandle, hit->s.origin, hit->s.angles);
contents |= c2;
}
return contents;
}
示例3: SV_PointContents
/*
=============
SV_PointContents
=============
*/
int SV_PointContents (vec3_t p)
{
edict_t *touch[MAX_EDICTS], *hit;
int i, num;
int contents, c2;
int headnode;
float *angles;
// get base contents from world
contents = CM_PointContents (p, sv.models[1]->headnode);
// or in contents from all the other entities
num = SV_AreaEdicts (p, p, touch, MAX_EDICTS, AREA_SOLID);
for (i=0 ; i<num ; i++)
{
hit = touch[i];
// might intersect, so do an exact clip
headnode = SV_HullForEntity (hit);
angles = hit->s.angles;
if (hit->solid != SOLID_BSP)
angles = vec3_origin; // boxes don't rotate
c2 = CM_TransformedPointContents (p, headnode, hit->s.origin, hit->s.angles);
contents |= c2;
}
return contents;
}
示例4: SV_PointContents
/*
=============
SV_PointContents
=============
*/
int SV_PointContents(vec3_t p)
{
edict_t *touch[MAX_EDICTS], *hit;
int i, num;
int contents;
if (!sv.cm.cache) {
Com_Error(ERR_DROP, "%s: no map loaded", __func__);
}
// get base contents from world
contents = CM_PointContents(p, sv.cm.cache->nodes);
// or in contents from all the other entities
num = SV_AreaEdicts(p, p, touch, MAX_EDICTS, AREA_SOLID);
for (i = 0; i < num; i++) {
hit = touch[i];
// might intersect, so do an exact clip
contents |= CM_TransformedPointContents(p, SV_HullForEntity(hit),
hit->s.origin, hit->s.angles);
}
return contents;
}
示例5: SV_PointContents
/*
=============
SV_PointContents
=============
*/
int SV_PointContents( const vec3_t p, int passEntityNum ) {
int touch[MAX_GENTITIES];
sharedEntity_t *hit;
int i, num;
int contents, c2;
clipHandle_t clipHandle;
float *angles;
// get base contents from world
contents = CM_PointContents( p, 0 );
// or in contents from all the other entities
num = SV_AreaEntities( p, p, touch, MAX_GENTITIES );
for ( i=0 ; i<num ; i++ ) {
if ( touch[i] == passEntityNum ) {
continue;
}
hit = SV_GentityNum( touch[i] );
// might intersect, so do an exact clip
clipHandle = SV_ClipHandleForEntity( hit );
angles = hit->r.currentAngles;
if ( !hit->r.bmodel ) {
angles = vec3_origin; // boxes don't rotate
}
c2 = CM_TransformedPointContents (p, clipHandle, hit->r.currentOrigin, angles);
contents |= c2;
}
return contents;
}
示例6: TV_Module_CM_TransformedPointContents
static inline int TV_Module_CM_TransformedPointContents( relay_t *relay, vec3_t p, struct cmodel_s *cmodel,
vec3_t origin, vec3_t angles )
{
if( !relay )
{
Com_Printf( "Error: TV_Module_CM_TransformedPointContents: Relay not set\n" );
return 0;
}
return CM_TransformedPointContents( relay->cms, p, cmodel, origin, angles );
}
示例7: EnumElement
IterationRetval_t EnumElement( IHandleEntity *pHandleEntity )
{
ICollideable *pCollide;
const char *pDbgName;
m_pEngineTrace->HandleEntityToCollideable( pHandleEntity, &pCollide, &pDbgName );
if (!pCollide)
return ITERATION_CONTINUE;
// Deal with static props
// NOTE: I could have added static props to a different list and
// enumerated them separately, but that would have been less efficient
if ( StaticPropMgr()->IsStaticProp( pHandleEntity ) )
{
Ray_t ray;
trace_t trace;
ray.Init( m_Pos, m_Pos );
m_pEngineTrace->ClipRayToCollideable( ray, MASK_ALL, pCollide, &trace );
if (trace.startsolid)
{
// We're in a static prop; that's solid baby
// Pretend we hit the world
m_Contents = CONTENTS_SOLID;
m_pCollide = m_pEngineTrace->GetWorldCollideable();
return ITERATION_STOP;
}
return ITERATION_CONTINUE;
}
// We only care about solid volumes
if ((pCollide->GetSolidFlags() & FSOLID_VOLUME_CONTENTS) == 0)
return ITERATION_CONTINUE;
model_t* pModel = (model_t*)pCollide->GetCollisionModel();
if ( pModel && pModel->type == mod_brush )
{
Assert( pCollide->GetCollisionModelIndex() < MAX_MODELS && pCollide->GetCollisionModelIndex() >= 0 );
int nHeadNode = GetModelHeadNode( pCollide );
int contents = CM_TransformedPointContents( m_Pos, nHeadNode,
pCollide->GetCollisionOrigin(), pCollide->GetCollisionAngles() );
if (contents != CONTENTS_EMPTY)
{
// Return the contents of the first thing we hit
m_Contents = contents;
m_pCollide = pCollide;
return ITERATION_STOP;
}
}
return ITERATION_CONTINUE;
}
示例8: SV_PointContents
/*
* SV_PointContents
*/
int
SV_PointContents(const Vec3 p, int passEntityNum)
{
int touch[MAX_GENTITIES];
Sharedent *hit;
int i, num;
int contents, c2;
Cliphandle clipHandle;
float *angles;
/* get base contents from world */
contents = CM_PointContents(p, 0);
/* or in contents from all the other entities */
num = SV_AreaEntities(p, p, touch, MAX_GENTITIES);
for(i=0; i<num; i++){
if(touch[i] == passEntityNum)
continue;
hit = SV_GentityNum(touch[i]);
/* might intersect, so do an exact clip */
clipHandle = SV_ClipHandleForEntity(hit);
angles = hit->r.currentAngles;
if(!hit->r.bmodel)
angles = vec3_origin; /* boxes don't rotate */
c2 =
CM_TransformedPointContents (p, clipHandle,
hit->r.currentOrigin,
angles);
contents |= c2;
}
return contents;
}
示例9: CL_CgameSystemCalls
/*
====================
CL_CgameSystemCalls
The cgame module is making a system call
====================
*/
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
switch( args[0] ) {
case CG_PRINT:
Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case CG_ERROR:
Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case CG_MILLISECONDS:
return Sys_Milliseconds();
case CG_CVAR_REGISTER:
Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] );
return 0;
case CG_CVAR_UPDATE:
Cvar_Update( VMA(1) );
return 0;
case CG_CVAR_SET:
Cvar_Set( VMA(1), VMA(2) );
return 0;
case CG_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
return 0;
case CG_ARGC:
return Cmd_Argc();
case CG_ARGV:
Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
return 0;
case CG_ARGS:
Cmd_ArgsBuffer( VMA(1), args[2] );
return 0;
case CG_FS_FOPENFILE:
return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );
case CG_FS_READ:
FS_Read2( VMA(1), args[2], args[3] );
return 0;
case CG_FS_WRITE:
FS_Write( VMA(1), args[2], args[3] );
return 0;
case CG_FS_FCLOSEFILE:
FS_FCloseFile( args[1] );
return 0;
case CG_FS_SEEK:
return FS_Seek( args[1], args[2], args[3] );
case CG_SENDCONSOLECOMMAND:
Cbuf_AddText( VMA(1) );
return 0;
case CG_ADDCOMMAND:
CL_AddCgameCommand( VMA(1) );
return 0;
case CG_REMOVECOMMAND:
Cmd_RemoveCommand( VMA(1) );
return 0;
case CG_SENDCLIENTCOMMAND:
CL_AddReliableCommand( VMA(1) );
return 0;
case CG_UPDATESCREEN:
// this is used during lengthy level loading, so pump message loop
// Com_EventLoop(); // FIXME: if a server restarts here, BAD THINGS HAPPEN!
// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
// if there is a map change while we are downloading at pk3.
// ZOID
SCR_UpdateScreen();
return 0;
case CG_CM_LOADMAP:
CL_CM_LoadMap( VMA(1) );
return 0;
case CG_CM_NUMINLINEMODELS:
return CM_NumInlineModels();
case CG_CM_INLINEMODEL:
return CM_InlineModel( args[1] );
case CG_CM_TEMPBOXMODEL:
return CM_TempBoxModel( VMA(1), VMA(2), /*int capsule*/ qfalse );
case CG_CM_TEMPCAPSULEMODEL:
return CM_TempBoxModel( VMA(1), VMA(2), /*int capsule*/ qtrue );
case CG_CM_POINTCONTENTS:
return CM_PointContents( VMA(1), args[2] );
case CG_CM_TRANSFORMEDPOINTCONTENTS:
return CM_TransformedPointContents( VMA(1), args[2], VMA(3), VMA(4) );
case CG_CM_BOXTRACE:
CM_BoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qfalse );
return 0;
case CG_CM_CAPSULETRACE:
CM_BoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qtrue );
return 0;
case CG_CM_TRANSFORMEDBOXTRACE:
CM_TransformedBoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qfalse );
return 0;
case CG_CM_TRANSFORMEDCAPSULETRACE:
CM_TransformedBoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qtrue );
return 0;
case CG_CM_MARKFRAGMENTS:
return re.MarkFragments( args[1], VMA(2), VMA(3), args[4], VMA(5), args[6], VMA(7) );
case CG_S_STARTSOUND:
//.........这里部分代码省略.........
示例10: CL_CgameSystemCalls
intptr_t CL_CgameSystemCalls(intptr_t *args)
{
switch (args[0])
{
case CG_PRINT:
Com_Printf("%s", (char *)VMA(1));
return 0;
case CG_ERROR:
Com_Error(ERR_DROP, "%s", (char *)VMA(1));
return 0;
case CG_MILLISECONDS:
return Sys_Milliseconds();
case CG_CVAR_REGISTER:
Cvar_Register(VMA(1), VMA(2), VMA(3), args[4]);
return 0;
case CG_CVAR_UPDATE:
Cvar_Update(VMA(1));
return 0;
case CG_CVAR_SET:
Cvar_SetSafe(VMA(1), VMA(2));
return 0;
case CG_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer(VMA(1), VMA(2), args[3]);
return 0;
case CG_CVAR_LATCHEDVARIABLESTRINGBUFFER:
Cvar_LatchedVariableStringBuffer(VMA(1), VMA(2), args[3]);
return 0;
case CG_ARGC:
return Cmd_Argc();
case CG_ARGV:
Cmd_ArgvBuffer(args[1], VMA(2), args[3]);
return 0;
case CG_ARGS:
Cmd_ArgsBuffer(VMA(1), args[2]);
return 0;
case CG_FS_FOPENFILE:
return FS_FOpenFileByMode(VMA(1), VMA(2), args[3]);
case CG_FS_READ:
FS_Read(VMA(1), args[2], args[3]);
return 0;
case CG_FS_WRITE:
return FS_Write(VMA(1), args[2], args[3]);
case CG_FS_FCLOSEFILE:
FS_FCloseFile(args[1]);
return 0;
case CG_FS_GETFILELIST:
return FS_GetFileList(VMA(1), VMA(2), VMA(3), args[4]);
case CG_FS_DELETEFILE:
return FS_Delete(VMA(1));
case CG_SENDCONSOLECOMMAND:
Cbuf_AddText(VMA(1));
return 0;
case CG_ADDCOMMAND:
CL_AddCgameCommand(VMA(1));
return 0;
case CG_REMOVECOMMAND:
Cmd_RemoveCommandSafe(VMA(1));
return 0;
case CG_SENDCLIENTCOMMAND:
CL_AddReliableCommand(VMA(1));
return 0;
case CG_UPDATESCREEN:
SCR_UpdateScreen();
return 0;
case CG_CM_LOADMAP:
CL_CM_LoadMap(VMA(1));
return 0;
case CG_CM_NUMINLINEMODELS:
return CM_NumInlineModels();
case CG_CM_INLINEMODEL:
return CM_InlineModel(args[1]);
case CG_CM_TEMPBOXMODEL:
return CM_TempBoxModel(VMA(1), VMA(2), qfalse);
case CG_CM_TEMPCAPSULEMODEL:
return CM_TempBoxModel(VMA(1), VMA(2), qtrue);
case CG_CM_POINTCONTENTS:
return CM_PointContents(VMA(1), args[2]);
case CG_CM_TRANSFORMEDPOINTCONTENTS:
return CM_TransformedPointContents(VMA(1), args[2], VMA(3), VMA(4));
case CG_CM_BOXTRACE:
CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qfalse);
return 0;
case CG_CM_CAPSULETRACE:
CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qtrue);
return 0;
case CG_CM_TRANSFORMEDBOXTRACE:
CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qfalse);
return 0;
case CG_CM_TRANSFORMEDCAPSULETRACE:
CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qtrue);
return 0;
case CG_CM_MARKFRAGMENTS:
return re.MarkFragments(args[1], VMA(2), VMA(3), args[4], VMA(5), args[6], VMA(7));
case CG_R_PROJECTDECAL:
re.ProjectDecal(args[1], args[2], VMA(3), VMA(4), VMA(5), args[6], args[7]);
return 0;
case CG_R_CLEARDECALS:
re.ClearDecals();
return 0;
//.........这里部分代码省略.........
示例11: CL_CgameSystemCalls
//.........这里部分代码省略.........
completer( VMA( 1 ) );
}
return 0;
case CG_SENDCLIENTCOMMAND:
CL_AddReliableCommand( VMA( 1 ) );
return 0;
case CG_UPDATESCREEN:
SCR_UpdateScreen();
return 0;
case CG_CM_LOADMAP:
CL_CM_LoadMap( VMA( 1 ) );
return 0;
case CG_CM_NUMINLINEMODELS:
return CM_NumInlineModels();
case CG_CM_INLINEMODEL:
return CM_InlineModel( args[ 1 ] );
case CG_CM_TEMPBOXMODEL:
return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qfalse );
case CG_CM_TEMPCAPSULEMODEL:
return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qtrue );
case CG_CM_POINTCONTENTS:
return CM_PointContents( VMA( 1 ), args[ 2 ] );
case CG_CM_TRANSFORMEDPOINTCONTENTS:
return CM_TransformedPointContents( VMA( 1 ), args[ 2 ], VMA( 3 ), VMA( 4 ) );
case CG_CM_BOXTRACE:
CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], TT_AABB );
return 0;
case CG_CM_TRANSFORMEDBOXTRACE:
CM_TransformedBoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], VMA( 8 ), VMA( 9 ), TT_AABB );
return 0;
case CG_CM_CAPSULETRACE:
CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], TT_CAPSULE );
return 0;
case CG_CM_TRANSFORMEDCAPSULETRACE:
CM_TransformedBoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], VMA( 8 ), VMA( 9 ), TT_CAPSULE );
return 0;
case CG_CM_BISPHERETRACE:
CM_BiSphereTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMF( 4 ), VMF( 5 ), args[ 6 ], args[ 7 ] );
return 0;
case CG_CM_TRANSFORMEDBISPHERETRACE:
CM_TransformedBiSphereTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMF( 4 ), VMF( 5 ), args[ 6 ], args[ 7 ], VMA( 8 ) );
return 0;
case CG_CM_MARKFRAGMENTS:
return re.MarkFragments( args[ 1 ], VMA( 2 ), VMA( 3 ), args[ 4 ], VMA( 5 ), args[ 6 ], VMA( 7 ) );
case CG_R_PROJECTDECAL:
re.ProjectDecal( args[ 1 ], args[ 2 ], VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ] );
return 0;
示例12: PF_CM_TransformedPointContents
static inline int PF_CM_TransformedPointContents( vec3_t p, struct cmodel_s *cmodel, vec3_t origin, vec3_t angles ) {
return CM_TransformedPointContents( svs.cms, p, cmodel, origin, angles );
}
示例13: CL_CgameSystemCalls
//.........这里部分代码省略.........
Cbuf_AddText( (const char*)VMA(1) );
return 0;
case CG_ADDCOMMAND:
Cmd_AddCommand( (const char*)VMA(1), NULL );
return 0;
case CG_REMOVECOMMAND:
Cmd_RemoveCommandSafe( (const char*)VMA(1) );
return 0;
case CG_SENDCLIENTCOMMAND:
CL_AddReliableCommand((const char*)VMA(1), false);
return 0;
case CG_UPDATESCREEN:
// this is used during lengthy level loading, so pump message loop
// Com_EventLoop(); // FIXME: if a server restarts here, BAD THINGS HAPPEN!
// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
// if there is a map change while we are downloading at pk3.
// ZOID
SCR_UpdateScreen();
return 0;
case CG_CM_LOADMAP:
CL_CM_LoadMap( (const char*)VMA(1) );
return 0;
case CG_CM_NUMINLINEMODELS:
return CM_NumInlineModels();
case CG_CM_INLINEMODEL:
return CM_InlineModel( args[1] );
case CG_CM_TEMPBOXMODEL:
return CM_TempBoxModel( (const float*)VMA(1), (const float*)VMA(2), false );
case CG_CM_TEMPCAPSULEMODEL:
return CM_TempBoxModel( (const float*)VMA(1), (const float*)VMA(2), true );
case CG_CM_POINTCONTENTS:
return CM_PointContents( (const float*)VMA(1), args[2] );
case CG_CM_TRANSFORMEDPOINTCONTENTS:
return CM_TransformedPointContents( (const float*)VMA(1), (clipHandle_t)args[2],
(const float*)VMA(3), (const float*)VMA(4) );
case CG_CM_BOXTRACE:
CM_BoxTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
(float*)VMA(4), (float*)VMA(5), (clipHandle_t)args[6], args[7], TT_AABB );
return 0;
case CG_CM_CAPSULETRACE:
CM_BoxTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
(float*)VMA(4), (float*)VMA(5), (clipHandle_t)args[6], args[7], TT_CAPSULE );
return 0;
case CG_CM_TRANSFORMEDBOXTRACE:
CM_TransformedBoxTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
(float*)VMA(4), (float*)VMA(5), (clipHandle_t)args[6], args[7],
(const float*)VMA(8), (const float*)VMA(9), TT_AABB );
return 0;
case CG_CM_TRANSFORMEDCAPSULETRACE:
CM_TransformedBoxTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
(float*)VMA(4), (float*)VMA(5), (clipHandle_t)args[6], args[7],
(const float*)VMA(8), (const float*)VMA(9), TT_CAPSULE );
return 0;
case CG_CM_BISPHERETRACE:
CM_BiSphereTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3), VMF(4), VMF(5), (clipHandle_t)args[6], args[7] );
return 0;
case CG_CM_TRANSFORMEDBISPHERETRACE:
CM_TransformedBiSphereTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
VMF(4), VMF(5), (clipHandle_t)args[6], args[7], (const float*)VMA(8) );
return 0;
case CG_CM_MARKFRAGMENTS:
{
float (&arg2)[3][3] = *reinterpret_cast<float (*)[3][3]>(VMA(2));
return re.MarkFragments( args[1], arg2, (const float*)VMA(3), args[4], (float*)VMA(5), args[6], (markFragment_t*)VMA(7) );
}
case CG_S_STARTSOUND:
示例14: CL_CgameSystemCalls
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
#ifndef __NO_JK2
if( com_jk2 && com_jk2->integer )
{
args[0] = (intptr_t)CL_ConvertJK2SysCall((cgameJK2Import_t)args[0]);
}
#endif
switch( args[0] ) {
case CG_PRINT:
Com_Printf( "%s", VMA(1) );
return 0;
case CG_ERROR:
Com_Error( ERR_DROP, S_COLOR_RED"%s", VMA(1) );
return 0;
case CG_MILLISECONDS:
return Sys_Milliseconds();
case CG_CVAR_REGISTER:
Cvar_Register( (vmCvar_t *) VMA(1), (const char *) VMA(2), (const char *) VMA(3), args[4] );
return 0;
case CG_CVAR_UPDATE:
Cvar_Update( (vmCvar_t *) VMA(1) );
return 0;
case CG_CVAR_SET:
Cvar_Set( (const char *) VMA(1), (const char *) VMA(2) );
return 0;
case CG_ARGC:
return Cmd_Argc();
case CG_ARGV:
Cmd_ArgvBuffer( args[1], (char *) VMA(2), args[3] );
return 0;
case CG_ARGS:
Cmd_ArgsBuffer( (char *) VMA(1), args[2] );
return 0;
case CG_FS_FOPENFILE:
return FS_FOpenFileByMode( (const char *) VMA(1), (int *) VMA(2), (fsMode_t) args[3] );
case CG_FS_READ:
FS_Read( VMA(1), args[2], args[3] );
return 0;
case CG_FS_WRITE:
FS_Write( VMA(1), args[2], args[3] );
return 0;
case CG_FS_FCLOSEFILE:
FS_FCloseFile( args[1] );
return 0;
case CG_SENDCONSOLECOMMAND:
Cbuf_AddText( (const char *) VMA(1) );
return 0;
case CG_ADDCOMMAND:
CL_AddCgameCommand( (const char *) VMA(1) );
return 0;
case CG_SENDCLIENTCOMMAND:
CL_AddReliableCommand( (const char *) VMA(1) );
return 0;
case CG_UPDATESCREEN:
// this is used during lengthy level loading, so pump message loop
Com_EventLoop(); // FIXME: if a server restarts here, BAD THINGS HAPPEN!
SCR_UpdateScreen();
return 0;
case CG_RMG_INIT:
/*
if (!com_sv_running->integer)
{ // don't do this if we are connected locally
if (!TheRandomMissionManager)
{
TheRandomMissionManager = new CRMManager;
}
TheRandomMissionManager->SetLandScape( cmg.landScapes[args[1]] );
TheRandomMissionManager->LoadMission(qfalse);
TheRandomMissionManager->SpawnMission(qfalse);
cmg.landScapes[args[1]]->UpdatePatches();
}
*/ //this is SP.. I guess we're always the client and server.
// cl.mRMGChecksum = cm.landScapes[args[1]]->get_rand_seed();
RM_CreateRandomModels(args[1], (const char *)VMA(2));
//cmg.landScapes[args[1]]->rand_seed(cl.mRMGChecksum); // restore it, in case we do a vid restart
cmg.landScape->rand_seed(cmg.landScape->get_rand_seed());
// TheRandomMissionManager->CreateMap();
return 0;
case CG_CM_REGISTER_TERRAIN:
return CM_RegisterTerrain((const char *)VMA(1), false)->GetTerrainId();
case CG_RE_INIT_RENDERER_TERRAIN:
re.InitRendererTerrain((const char *)VMA(1));
return 0;
case CG_CM_LOADMAP:
CL_CM_LoadMap( (const char *) VMA(1), args[2] );
return 0;
case CG_CM_NUMINLINEMODELS:
return CM_NumInlineModels();
case CG_CM_INLINEMODEL:
return CM_InlineModel( args[1] );
case CG_CM_TEMPBOXMODEL:
return CM_TempBoxModel( (const float *) VMA(1), (const float *) VMA(2) );//, (int) VMA(3) );
case CG_CM_POINTCONTENTS:
return CM_PointContents( (float *)VMA(1), args[2] );
case CG_CM_TRANSFORMEDPOINTCONTENTS:
return CM_TransformedPointContents( (const float *) VMA(1), args[2], (const float *) VMA(3), (const float *) VMA(4) );
case CG_CM_BOXTRACE:
CM_BoxTrace( (trace_t *) VMA(1), (const float *) VMA(2), (const float *) VMA(3), (const float *) VMA(4), (const float *) VMA(5), args[6], args[7] );
//.........这里部分代码省略.........
示例15: CL_CgameSystemCalls
/*
====================
CL_CgameSystemCalls
The cgame module is making a system call
====================
*/
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
switch ( args[0] ) {
case CG_PRINT:
Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case CG_ERROR:
Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case CG_MILLISECONDS:
return Sys_Milliseconds();
case CG_CVAR_REGISTER:
Cvar_Register( VMA( 1 ), VMA( 2 ), VMA( 3 ), args[4] );
return 0;
case CG_CVAR_UPDATE:
Cvar_Update( VMA( 1 ) );
return 0;
case CG_CVAR_SET:
Cvar_SetSafe( VMA(1), VMA(2) );
return 0;
case CG_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer( VMA( 1 ), VMA( 2 ), args[3] );
return 0;
case CG_ARGC:
return Cmd_Argc();
case CG_ARGV:
Cmd_ArgvBuffer( args[1], VMA( 2 ), args[3] );
return 0;
case CG_ARGS:
Cmd_ArgsBuffer( VMA( 1 ), args[2] );
return 0;
case CG_FS_FOPENFILE:
return FS_FOpenFileByMode( VMA( 1 ), VMA( 2 ), args[3] );
case CG_FS_READ:
FS_Read( VMA( 1 ), args[2], args[3] );
return 0;
case CG_FS_WRITE:
return FS_Write( VMA( 1 ), args[2], args[3] );
case CG_FS_FCLOSEFILE:
FS_FCloseFile( args[1] );
return 0;
case CG_SENDCONSOLECOMMAND:
Cbuf_AddText( VMA( 1 ) );
return 0;
case CG_ADDCOMMAND:
CL_AddCgameCommand( VMA( 1 ) );
return 0;
case CG_REMOVECOMMAND:
Cmd_RemoveCommandSafe( VMA(1) );
return 0;
case CG_SENDCLIENTCOMMAND:
CL_AddReliableCommand(VMA(1), qfalse);
return 0;
case CG_UPDATESCREEN:
// this is used during lengthy level loading, so pump message loop
// Com_EventLoop(); // FIXME: if a server restarts here, BAD THINGS HAPPEN!
// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
// if there is a map change while we are downloading at pk3.
// ZOID
SCR_UpdateScreen();
return 0;
case CG_CM_LOADMAP:
CL_CM_LoadMap( VMA( 1 ) );
return 0;
case CG_CM_NUMINLINEMODELS:
return CM_NumInlineModels();
case CG_CM_INLINEMODEL:
return CM_InlineModel( args[1] );
case CG_CM_TEMPBOXMODEL:
return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qfalse );
case CG_CM_TEMPCAPSULEMODEL:
return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qtrue );
case CG_CM_POINTCONTENTS:
return CM_PointContents( VMA( 1 ), args[2] );
case CG_CM_TRANSFORMEDPOINTCONTENTS:
return CM_TransformedPointContents( VMA( 1 ), args[2], VMA( 3 ), VMA( 4 ) );
case CG_CM_BOXTRACE:
CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[6], args[7], /*int capsule*/ qfalse );
return 0;
case CG_CM_TRANSFORMEDBOXTRACE:
CM_TransformedBoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[6], args[7], VMA( 8 ), VMA( 9 ), /*int capsule*/ qfalse );
return 0;
case CG_CM_CAPSULETRACE:
CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[6], args[7], /*int capsule*/ qtrue );
return 0;
case CG_CM_TRANSFORMEDCAPSULETRACE:
CM_TransformedBoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[6], args[7], VMA( 8 ), VMA( 9 ), /*int capsule*/ qtrue );
return 0;
case CG_CM_MARKFRAGMENTS:
return re.MarkFragments( args[1], VMA( 2 ), VMA( 3 ), args[4], VMA( 5 ), args[6], VMA( 7 ) );
case CG_S_STARTSOUND:
S_StartSound( VMA( 1 ), args[2], args[3], args[4] );
return 0;
//----(SA) added
//.........这里部分代码省略.........