本文整理汇总了C++中CM_TempBoxModel函数的典型用法代码示例。如果您正苦于以下问题:C++ CM_TempBoxModel函数的具体用法?C++ CM_TempBoxModel怎么用?C++ CM_TempBoxModel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CM_TempBoxModel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SV_ClipHandleForEntity
/*
* SV_ClipHandleForEntity
*
* Returns a headnode that can be used for testing or clipping to a
* given entity. If the entity is a bsp model, the headnode will
* be returned, otherwise a custom box tree will be constructed.
*/
Cliphandle
SV_ClipHandleForEntity(const Sharedent *ent)
{
if(ent->r.bmodel)
/* explicit hulls in the BSP model */
return CM_InlineModel(ent->s.modelindex);
if(ent->r.svFlags & SVF_CAPSULE)
/* create a temp capsule from bounding box sizes */
return CM_TempBoxModel(ent->r.mins, ent->r.maxs, qtrue);
/* create a temp tree from bounding box sizes */
return CM_TempBoxModel(ent->r.mins, ent->r.maxs, qfalse);
}
示例2: SV_ClipHandleForEntity
/*
================
SV_ClipHandleForEntity
Returns a headnode that can be used for testing or clipping to a
given entity. If the entity is a bsp model, the headnode will
be returned, otherwise a custom box tree will be constructed.
================
*/
clipHandle_t SV_ClipHandleForEntity( const sharedEntity_t *ent ) {
if ( ent->r.bmodel ) {
// explicit hulls in the BSP model
return CM_InlineModel( ent->s.modelindex );
}
if ( ent->r.svFlags & SVF_CAPSULE ) {
// create a temp capsule from bounding box sizes
return CM_TempBoxModel( ent->r.mins, ent->r.maxs, qtrue );
}
// create a temp tree from bounding box sizes
return CM_TempBoxModel( ent->r.mins, ent->r.maxs, qfalse );
}
示例3: CM_TraceBoundingBoxThroughCapsule
// bounding box vs. capsule collision
void CM_TraceBoundingBoxThroughCapsule( traceWork_t *tw, clipHandle_t model ) {
vector3 mins, maxs, offset, size[2];
clipHandle_t h;
cmodel_t *cmod;
int i;
// mins maxs of the capsule
CM_ModelBounds(model, &mins, &maxs);
// offset for capsule center
for ( i = 0 ; i < 3 ; i++ ) {
offset.data[i] = ( mins.data[i] + maxs.data[i] ) * 0.5f;
size[0].data[i] = mins.data[i] - offset.data[i];
size[1].data[i] = maxs.data[i] - offset.data[i];
tw->start.data[i] -= offset.data[i];
tw->end.data[i] -= offset.data[i];
}
// replace the bounding box with the capsule
tw->sphere.use = qtrue;
tw->sphere.radius = ( size[1].x > size[1].z ) ? size[1].z: size[1].x;
tw->sphere.halfheight = size[1].z;
VectorSet( &tw->sphere.offset, 0, 0, size[1].z - tw->sphere.radius );
// replace the capsule with the bounding box
h = CM_TempBoxModel(&tw->size[0], &tw->size[1], qfalse);
// calculate collision
cmod = CM_ClipHandleToModel( h );
CM_TraceThroughLeaf( tw, &cmod->leaf );
}
示例4: SV_ClipHandleForEntity
/*
================
SV_ClipHandleForEntity
Returns a headnode that can be used for testing or clipping to a
given entity. If the entity is a bsp model, the headnode will
be returned, otherwise a custom box tree will be constructed.
================
*/
clipHandle_t SV_ClipHandleForEntity( EntityBase* gameEnt )
{
if ( gameEnt->r.bmodel )
{
// explicit hulls in the BSP model
return CM_InlineModel( gameEnt->s.modelindex );
}
if ( gameEnt->r.svFlags & SVF_CAPSULE )
{
// create a temp capsule from bounding box sizes
return CM_TempBoxModel( gameEnt->r.mins, gameEnt->r.maxs, true );
}
// create a temp tree from bounding box sizes
return CM_TempBoxModel( gameEnt->r.mins, gameEnt->r.maxs, false );
}
示例5: CM_TestBoundingBoxInCapsule
/*
==================
CM_TestBoundingBoxInCapsule
bounding box inside capsule check
==================
*/
void CM_TestBoundingBoxInCapsule(traceWork_t *tw, clipHandle_t model)
{
vec3_t mins, maxs, offset, size[2];
clipHandle_t h;
cmodel_t *cmod;
int i;
// mins maxs of the capsule
CM_ModelBounds(model, mins, maxs);
// offset for capsule center
for (i = 0 ; i < 3 ; i++)
{
offset[i] = (mins[i] + maxs[i]) * 0.5;
size[0][i] = mins[i] - offset[i];
size[1][i] = maxs[i] - offset[i];
tw->start[i] -= offset[i];
tw->end[i] -= offset[i];
}
// replace the bounding box with the capsule
tw->sphere.use = qtrue;
tw->sphere.radius = (size[1][0] > size[1][2]) ? size[1][2] : size[1][0];
tw->sphere.halfheight = size[1][2];
VectorSet(tw->sphere.offset, 0, 0, size[1][2] - tw->sphere.radius);
// replace the capsule with the bounding box
h = CM_TempBoxModel(tw->size[0], tw->size[1], qfalse);
// calculate collision
cmod = CM_ClipHandleToModel(h);
CM_TestInLeaf(tw, &cmod->leaf);
}
示例6: CLQ2_ClipMoveToEntities
static void CLQ2_ClipMoveToEntities( const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, q2trace_t* tr ) {
for ( int i = 0; i < cl.q2_frame.num_entities; i++ ) {
int num = ( cl.q2_frame.parse_entities + i ) & ( MAX_PARSE_ENTITIES_Q2 - 1 );
q2entity_state_t* ent = &clq2_parse_entities[ num ];
if ( !ent->solid ) {
continue;
}
if ( ent->number == cl.playernum + 1 ) {
continue;
}
clipHandle_t cmodel;
float* angles;
if ( ent->solid == 31 ) {
// special value for bmodel
cmodel = cl.model_clip[ ent->modelindex ];
if ( !cmodel ) {
continue;
}
angles = ent->angles;
} else {
// encoded bbox
int x = 8 * ( ent->solid & 31 );
int zd = 8 * ( ( ent->solid >> 5 ) & 31 );
int zu = 8 * ( ( ent->solid >> 10 ) & 63 ) - 32;
vec3_t bmins, bmaxs;
bmins[ 0 ] = bmins[ 1 ] = -x;
bmaxs[ 0 ] = bmaxs[ 1 ] = x;
bmins[ 2 ] = -zd;
bmaxs[ 2 ] = zu;
cmodel = CM_TempBoxModel( bmins, bmaxs );
angles = oldvec3_origin; // boxes don't rotate
}
if ( tr->allsolid ) {
return;
}
q2trace_t trace = CM_TransformedBoxTraceQ2( start, end,
mins, maxs, cmodel, MASK_PLAYERSOLID,
ent->origin, angles );
if ( trace.allsolid || trace.startsolid ||
trace.fraction < tr->fraction ) {
trace.ent = ( struct q2edict_t* )ent;
if ( tr->startsolid ) {
*tr = trace;
tr->startsolid = true;
} else {
*tr = trace;
}
} else if ( trace.startsolid ) {
tr->startsolid = true;
}
}
}
示例7: SV_ClipHandleForEntity
clipHandle_t SV_ClipHandleForEntity(gentity_t *touch)
{
if(!touch->r.bmodel)
return CM_TempBoxModel(touch->r.mins, touch->r.maxs, touch->r.contents);
else
return touch->s.index;
}
示例8: SV_ClipHandleForEntity
/*
================
SV_ClipHandleForEntity
Returns a headnode that can be used for testing or clipping to a
given entity. If the entity is a bsp model, the headnode will
be returned, otherwise a custom box tree or capsule will be constructed.
================
*/
clipHandle_t SV_ClipHandleForEntity( const sharedEntity_t *ent ) {
if ( ent->s.bmodel ) {
// explicit hulls in the BSP model
return CM_InlineModel( ent->s.modelindex );
}
// create a temp tree or capsule from bounding box sizes
return CM_TempBoxModel( ent->s.mins, ent->s.maxs, ent->s.capsule, ent->s.contents );
}
示例9: CM_TestBoundingBoxInCapsule
/*
==================
CM_TestBoundingBoxInCapsule
bounding box inside capsule check
==================
*/
void CM_TestBoundingBoxInCapsule( traceWork_t *tw, clipHandle_t model ) {
vec3_t mins, maxs, offset, bboxSize[2];
clipHandle_t h;
cmodel_t *cmod;
int i;
// save size of the bounding box
VectorCopy(tw->size[0], bboxSize[0]);
VectorCopy(tw->size[1], bboxSize[1]);
// mins maxs of the capsule
CM_ModelBounds(model, mins, maxs);
// offset for capsule center
for ( i = 0 ; i < 3 ; i++ ) {
offset[i] = ( mins[i] + maxs[i] ) * 0.5;
tw->size[0][i] = mins[i] - offset[i];
tw->size[1][i] = maxs[i] - offset[i];
tw->start[i] -= offset[i];
tw->end[i] -= offset[i];
if ( tw->start[i] < tw->end[i] ) {
tw->bounds[0][i] = tw->start[i] + tw->size[0][i];
tw->bounds[1][i] = tw->end[i] + tw->size[1][i];
} else {
tw->bounds[0][i] = tw->end[i] + tw->size[0][i];
tw->bounds[1][i] = tw->start[i] + tw->size[1][i];
}
}
// replace the bounding box with the capsule
tw->type = TT_CAPSULE;
tw->sphere.radius = ( tw->size[1][0] > tw->size[1][2] ) ? tw->size[1][2]: tw->size[1][0];
tw->sphere.halfheight = tw->size[1][2];
VectorSet( tw->sphere.offset, 0, 0, tw->size[1][2] - tw->sphere.radius );
// replace the capsule with the bounding box
h = CM_TempBoxModel(bboxSize[0], bboxSize[1], qfalse, capsule_contents);
// calculate collision
cmod = CM_ClipHandleToModel( h );
CM_TestInLeaf( tw, &cmod->leaf );
}
示例10: 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", VMA(1) );
return 0;
case CG_FATAL_ERROR:
Com_Error( ERR_DROP, "%s", 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_ARGVI:
return atoi( Cmd_Argv( args[1] ) );
case CG_ARGS:
Cmd_ArgsBuffer( VMA(1), args[2] );
return 0;
case CG_CMD_EXECUTETEXT:
Cbuf_ExecuteText( args[1], VMA(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:
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( VMA(1) );
return 0;
case CG_FORWARDCOMMAND:
VM_Call( uivm, UI_CONSOLE_COMMAND, cls.realtime );
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;
//.........这里部分代码省略.........
示例11: 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:
//.........这里部分代码省略.........
示例12: 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;
//.........这里部分代码省略.........
示例13: CLWS_CgameSystemCalls
// The cgame module is making a system call
qintptr CLWS_CgameSystemCalls( qintptr* args ) {
switch ( args[ 0 ] ) {
case WSCG_PRINT:
common->Printf( "%s", ( char* )VMA( 1 ) );
return 0;
case WSCG_ERROR:
common->Error( "%s", ( char* )VMA( 1 ) );
return 0;
case WSCG_MILLISECONDS:
return Sys_Milliseconds();
case WSCG_CVAR_REGISTER:
Cvar_Register( ( vmCvar_t* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] );
return 0;
case WSCG_CVAR_UPDATE:
Cvar_Update( ( vmCvar_t* )VMA( 1 ) );
return 0;
case WSCG_CVAR_SET:
Cvar_Set( ( char* )VMA( 1 ), ( char* )VMA( 2 ) );
return 0;
case WSCG_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
return 0;
case WSCG_ARGC:
return Cmd_Argc();
case WSCG_ARGV:
Cmd_ArgvBuffer( args[ 1 ], ( char* )VMA( 2 ), args[ 3 ] );
return 0;
case WSCG_ARGS:
Cmd_ArgsBuffer( ( char* )VMA( 1 ), args[ 2 ] );
return 0;
case WSCG_FS_FOPENFILE:
return FS_FOpenFileByMode( ( char* )VMA( 1 ), ( fileHandle_t* )VMA( 2 ), ( fsMode_t )args[ 3 ] );
case WSCG_FS_READ:
FS_Read( VMA( 1 ), args[ 2 ], args[ 3 ] );
return 0;
case WSCG_FS_WRITE:
return FS_Write( VMA( 1 ), args[ 2 ], args[ 3 ] );
case WSCG_FS_FCLOSEFILE:
FS_FCloseFile( args[ 1 ] );
return 0;
case WSCG_SENDCONSOLECOMMAND:
Cbuf_AddText( ( char* )VMA( 1 ) );
return 0;
case WSCG_ADDCOMMAND:
CLT3_AddCgameCommand( ( char* )VMA( 1 ) );
return 0;
case WSCG_REMOVECOMMAND:
Cmd_RemoveCommand( ( char* )VMA( 1 ) );
return 0;
case WSCG_SENDCLIENTCOMMAND:
CL_AddReliableCommand( ( char* )VMA( 1 ) );
return 0;
case WSCG_UPDATESCREEN:
SCR_UpdateScreen();
return 0;
case WSCG_CM_LOADMAP:
CLT3_CM_LoadMap( ( char* )VMA( 1 ) );
return 0;
case WSCG_CM_NUMINLINEMODELS:
return CM_NumInlineModels();
case WSCG_CM_INLINEMODEL:
return CM_InlineModel( args[ 1 ] );
case WSCG_CM_TEMPBOXMODEL:
return CM_TempBoxModel( ( float* )VMA( 1 ), ( float* )VMA( 2 ), false );
case WSCG_CM_TEMPCAPSULEMODEL:
return CM_TempBoxModel( ( float* )VMA( 1 ), ( float* )VMA( 2 ), true );
case WSCG_CM_POINTCONTENTS:
return CM_PointContentsQ3( ( float* )VMA( 1 ), args[ 2 ] );
case WSCG_CM_TRANSFORMEDPOINTCONTENTS:
return CM_TransformedPointContentsQ3( ( float* )VMA( 1 ), args[ 2 ], ( float* )VMA( 3 ), ( float* )VMA( 4 ) );
case WSCG_CM_BOXTRACE:
CM_BoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], false );
return 0;
case WSCG_CM_TRANSFORMEDBOXTRACE:
CM_TransformedBoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], ( float* )VMA( 8 ), ( float* )VMA( 9 ), false );
return 0;
case WSCG_CM_CAPSULETRACE:
CM_BoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], true );
return 0;
case WSCG_CM_TRANSFORMEDCAPSULETRACE:
CM_TransformedBoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], ( float* )VMA( 8 ), ( float* )VMA( 9 ), true );
return 0;
case WSCG_CM_MARKFRAGMENTS:
return R_MarkFragmentsWolf( args[ 1 ], ( const vec3_t* )VMA( 2 ), ( float* )VMA( 3 ), args[ 4 ], ( float* )VMA( 5 ), args[ 6 ], ( markFragment_t* )VMA( 7 ) );
case WSCG_S_STARTSOUND:
S_StartSound( ( float* )VMA( 1 ), args[ 2 ], args[ 3 ], args[ 4 ], 0.5 );
return 0;
case WSCG_S_STARTSOUNDEX:
S_StartSoundEx( ( float* )VMA( 1 ), args[ 2 ], args[ 3 ], args[ 4 ], args[ 5 ], 127 );
return 0;
case WSCG_S_STARTLOCALSOUND:
S_StartLocalSound( args[ 1 ], args[ 2 ], 127 );
return 0;
case WSCG_S_CLEARLOOPINGSOUNDS:
CLWS_ClearLoopingSounds( args[ 1 ] );
return 0;
case WSCG_S_ADDLOOPINGSOUND:
// FIXME MrE: handling of looping sounds changed
S_AddLoopingSound( args[ 1 ], ( float* )VMA( 2 ), ( float* )VMA( 3 ), args[ 4 ], args[ 5 ], args[ 6 ], 0 );
//.........这里部分代码省略.........
示例14: CL_CgameSystemCalls
//.........这里部分代码省略.........
return 0;
case CG_REMOVECOMMAND:
Cmd_RemoveCommand( VMA( 1 ) );
return 0;
case CG_COMPLETE_CALLBACK:
if ( completer )
{
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 ) );
示例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
//.........这里部分代码省略.........