本文整理匯總了C++中FloatAsInt函數的典型用法代碼示例。如果您正苦於以下問題:C++ FloatAsInt函數的具體用法?C++ FloatAsInt怎麽用?C++ FloatAsInt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了FloatAsInt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: trap_Cvar_VariableValue
float trap_Cvar_VariableValue( const char *var_name )
{
int temp;
// temp = syscall( UI_CVAR_VARIABLEVALUE, var_name );
temp = FloatAsInt( Cvar_VariableValue(var_name) );
return (*(float*)&temp);
}
示例2: CL_CgameSystemCalls
//.........這裏部分代碼省略.........
return CL_GetUserCmd(args[1], VMA(2));
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue(args[1], args[2], VMF(3), args[4]);
return 0;
case CG_SETCLIENTLERPORIGIN:
CL_SetClientLerpOrigin(VMF(1), VMF(2), VMF(3));
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown(args[1]);
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
// Don't allow the cgame module to close the console
Key_SetCatcher(args[1] | (Key_GetCatcher() & KEYCATCH_CONSOLE));
return 0;
case CG_KEY_GETKEY:
return Key_GetKey(VMA(1));
case CG_KEY_GETOVERSTRIKEMODE:
return Key_GetOverstrikeMode();
case CG_KEY_SETOVERSTRIKEMODE:
Key_SetOverstrikeMode(args[1]);
return 0;
case CG_MEMSET:
return (intptr_t)memset(VMA(1), args[2], args[3]);
case CG_MEMCPY:
return (intptr_t)memcpy(VMA(1), VMA(2), args[3]);
case CG_STRNCPY:
return (intptr_t)strncpy(VMA(1), VMA(2), args[3]);
case CG_SIN:
return FloatAsInt(sin(VMF(1)));
case CG_COS:
return FloatAsInt(cos(VMF(1)));
case CG_ATAN2:
return FloatAsInt(atan2(VMF(1), VMF(2)));
case CG_SQRT:
return FloatAsInt(sqrt(VMF(1)));
case CG_FLOOR:
return FloatAsInt(floor(VMF(1)));
case CG_CEIL:
return FloatAsInt(ceil(VMF(1)));
case CG_ACOS:
return FloatAsInt(Q_acos(VMF(1)));
case CG_PC_ADD_GLOBAL_DEFINE:
return botlib_export->PC_AddGlobalDefine(VMA(1));
case CG_PC_LOAD_SOURCE:
return botlib_export->PC_LoadSourceHandle(VMA(1));
case CG_PC_FREE_SOURCE:
return botlib_export->PC_FreeSourceHandle(args[1]);
case CG_PC_READ_TOKEN:
return botlib_export->PC_ReadTokenHandle(args[1], VMA(2));
case CG_PC_SOURCE_FILE_AND_LINE:
return botlib_export->PC_SourceFileAndLine(args[1], VMA(2), VMA(3));
case CG_PC_UNREAD_TOKEN:
botlib_export->PC_UnreadLastTokenHandle(args[1]);
return 0;
case CG_S_STOPBACKGROUNDTRACK:
S_StopBackgroundTrack();
return 0;
case CG_REAL_TIME:
示例3: CL_UISystemCalls
/*
====================
CL_UISystemCalls
The ui module is making a system call
====================
*/
int CL_UISystemCalls( int *args ) {
switch( args[0] ) {
case UI_ERROR:
Com_Error( ERR_DROP, "%s", VMA(1) );
return 0;
case UI_PRINT:
Com_Printf( "%s", VMA(1) );
return 0;
case UI_MILLISECONDS:
return Sys_Milliseconds();
case UI_CVAR_REGISTER:
Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] );
return 0;
case UI_CVAR_UPDATE:
Cvar_Update( VMA(1) );
return 0;
case UI_CVAR_SET:
Cvar_Set( VMA(1), VMA(2) );
return 0;
case UI_CVAR_VARIABLEVALUE:
return FloatAsInt( Cvar_VariableValue( VMA(1) ) );
case UI_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
return 0;
case UI_CVAR_SETVALUE:
Cvar_SetValue( VMA(1), VMF(2) );
return 0;
case UI_CVAR_RESET:
Cvar_Reset( VMA(1) );
return 0;
case UI_CVAR_CREATE:
Cvar_Get( VMA(1), VMA(2), args[3] );
return 0;
case UI_CVAR_INFOSTRINGBUFFER:
Cvar_InfoStringBuffer( args[1], VMA(2), args[3] );
return 0;
case UI_ARGC:
return Cmd_Argc();
case UI_ARGV:
Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
return 0;
case UI_CMD_EXECUTETEXT:
Cbuf_ExecuteText( args[1], VMA(2) );
return 0;
case UI_FS_FOPENFILE:
return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );
case UI_FS_READ:
FS_Read2( VMA(1), args[2], args[3] );
return 0;
case UI_FS_WRITE:
FS_Write( VMA(1), args[2], args[3] );
return 0;
case UI_FS_FCLOSEFILE:
FS_FCloseFile( args[1] );
return 0;
case UI_FS_GETFILELIST:
return FS_GetFileList( VMA(1), VMA(2), VMA(3), args[4] );
case UI_FS_SEEK:
return FS_Seek( args[1], args[2], args[3] );
case UI_R_REGISTERMODEL:
#ifdef IOS_NOTYET
GLimp_AcquireGL();
return re.RegisterModel( VMA(1) );
GLimp_ReleaseGL();
#else
return re.RegisterModel( VMA(1) );
#endif // IOS
case UI_R_REGISTERSKIN:
#ifdef IOS_NOTYET
GLimp_AcquireGL();
return re.RegisterSkin( VMA(1) );
//.........這裏部分代碼省略.........
示例4: CLWS_CgameSystemCalls
//.........這裏部分代碼省略.........
CLWS_GetCurrentSnapshotNumber( ( int* )VMA( 1 ), ( int* )VMA( 2 ) );
return 0;
case WSCG_GETSNAPSHOT:
return CLWS_GetSnapshot( args[ 1 ], ( wssnapshot_t* )VMA( 2 ) );
case WSCG_GETSERVERCOMMAND:
return CLT3_GetServerCommand( args[ 1 ] );
case WSCG_GETCURRENTCMDNUMBER:
return CLT3_GetCurrentCmdNumber();
case WSCG_GETUSERCMD:
return CLWS_GetUserCmd( args[ 1 ], ( wsusercmd_t* )VMA( 2 ) );
case WSCG_SETUSERCMDVALUE:
CLWS_SetUserCmdValue( args[ 1 ], args[ 2 ], VMF( 3 ), args[ 4 ] ); //----(SA) modified // NERVE - SMF - added fourth arg [cld]
return 0;
case WSCG_MEMORY_REMAINING:
return 0x4000000;
case WSCG_KEY_ISDOWN:
return Key_IsDown( args[ 1 ] );
case WSCG_KEY_GETCATCHER:
return Key_GetCatcher();
case WSCG_KEY_SETCATCHER:
KeyQ3_SetCatcher( args[ 1 ] );
return 0;
case WSCG_KEY_GETKEY:
return Key_GetKey( ( char* )VMA( 1 ) );
case WSCG_MEMSET:
return ( qintptr )memset( VMA( 1 ), args[ 2 ], args[ 3 ] );
case WSCG_MEMCPY:
return ( qintptr )memcpy( VMA( 1 ), VMA( 2 ), args[ 3 ] );
case WSCG_STRNCPY:
String::NCpy( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
return args[ 1 ];
case WSCG_SIN:
return FloatAsInt( sin( VMF( 1 ) ) );
case WSCG_COS:
return FloatAsInt( cos( VMF( 1 ) ) );
case WSCG_ATAN2:
return FloatAsInt( atan2( VMF( 1 ), VMF( 2 ) ) );
case WSCG_SQRT:
return FloatAsInt( sqrt( VMF( 1 ) ) );
case WSCG_FLOOR:
return FloatAsInt( floor( VMF( 1 ) ) );
case WSCG_CEIL:
return FloatAsInt( ceil( VMF( 1 ) ) );
case WSCG_ACOS:
return FloatAsInt( idMath::ACos( VMF( 1 ) ) );
case WSCG_PC_ADD_GLOBAL_DEFINE:
return PC_AddGlobalDefine( ( char* )VMA( 1 ) );
case WSCG_PC_LOAD_SOURCE:
return PC_LoadSourceHandle( ( char* )VMA( 1 ) );
case WSCG_PC_FREE_SOURCE:
return PC_FreeSourceHandle( args[ 1 ] );
case WSCG_PC_READ_TOKEN:
return PC_ReadTokenHandleQ3( args[ 1 ], ( q3pc_token_t* )VMA( 2 ) );
case WSCG_PC_SOURCE_FILE_AND_LINE:
return PC_SourceFileAndLine( args[ 1 ], ( char* )VMA( 2 ), ( int* )VMA( 3 ) );
case WSCG_S_STOPBACKGROUNDTRACK:
S_StopBackgroundTrack();
return 0;
case WSCG_REAL_TIME:
return Com_RealTime( ( qtime_t* )VMA( 1 ) );
case WSCG_SNAPVECTOR:
Sys_SnapVector( ( float* )VMA( 1 ) );
示例5: CLWM_UISystemCalls
// The ui module is making a system call
qintptr CLWM_UISystemCalls( qintptr* args ) {
switch ( args[ 0 ] ) {
case WMUI_ERROR:
common->Error( "%s", ( char* )VMA( 1 ) );
return 0;
case WMUI_PRINT:
common->Printf( "%s", ( char* )VMA( 1 ) );
return 0;
case WMUI_MILLISECONDS:
return Sys_Milliseconds();
case WMUI_CVAR_REGISTER:
Cvar_Register( ( vmCvar_t* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] );
return 0;
case WMUI_CVAR_UPDATE:
Cvar_Update( ( vmCvar_t* )VMA( 1 ) );
return 0;
case WMUI_CVAR_SET:
Cvar_Set( ( char* )VMA( 1 ), ( char* )VMA( 2 ) );
return 0;
case WMUI_CVAR_VARIABLEVALUE:
return FloatAsInt( Cvar_VariableValue( ( char* )VMA( 1 ) ) );
case WMUI_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
return 0;
case WMUI_CVAR_SETVALUE:
Cvar_SetValue( ( char* )VMA( 1 ), VMF( 2 ) );
return 0;
case WMUI_CVAR_RESET:
Cvar_Reset( ( char* )VMA( 1 ) );
return 0;
case WMUI_CVAR_CREATE:
Cvar_Get( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
return 0;
case WMUI_CVAR_INFOSTRINGBUFFER:
Cvar_InfoStringBuffer( args[ 1 ], MAX_INFO_STRING_Q3, ( char* )VMA( 2 ), args[ 3 ] );
return 0;
case WMUI_ARGC:
return Cmd_Argc();
case WMUI_ARGV:
Cmd_ArgvBuffer( args[ 1 ], ( char* )VMA( 2 ), args[ 3 ] );
return 0;
case WMUI_CMD_EXECUTETEXT:
Cbuf_ExecuteText( args[ 1 ], ( char* )VMA( 2 ) );
return 0;
case WMUI_FS_FOPENFILE:
return FS_FOpenFileByMode( ( char* )VMA( 1 ), ( fileHandle_t* )VMA( 2 ), ( fsMode_t )args[ 3 ] );
case WMUI_FS_READ:
FS_Read( VMA( 1 ), args[ 2 ], args[ 3 ] );
return 0;
case WMUI_FS_WRITE:
FS_Write( VMA( 1 ), args[ 2 ], args[ 3 ] );
return 0;
case WMUI_FS_FCLOSEFILE:
FS_FCloseFile( args[ 1 ] );
return 0;
case WMUI_FS_DELETEFILE:
return FS_Delete( ( char* )VMA( 1 ) );
case WMUI_FS_GETFILELIST:
return FS_GetFileList( ( char* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] );
case WMUI_R_REGISTERMODEL:
return R_RegisterModel( ( char* )VMA( 1 ) );
case WMUI_R_REGISTERSKIN:
return R_RegisterSkin( ( char* )VMA( 1 ) );
case WMUI_R_REGISTERSHADERNOMIP:
return R_RegisterShaderNoMip( ( char* )VMA( 1 ) );
case WMUI_R_CLEARSCENE:
R_ClearScene();
return 0;
case WMUI_R_ADDREFENTITYTOSCENE:
CLWM_AddRefEntityToScene( ( wmrefEntity_t* )VMA( 1 ) );
return 0;
case WMUI_R_ADDPOLYTOSCENE:
R_AddPolyToScene( args[ 1 ], args[ 2 ], ( polyVert_t* )VMA( 3 ), 1 );
//.........這裏部分代碼省略.........
示例6: CL_UISystemCalls
/*
====================
CL_UISystemCalls
The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls(intptr_t * args) {
switch (args[0]) {
case UI_ERROR:
Com_Error(ERR_DROP, "%s", (char *)VMA(1));
return 0;
case UI_PRINT:
Com_Printf("%s", (char *)VMA(1));
return 0;
case UI_MILLISECONDS:
return Sys_Milliseconds();
case UI_CVAR_REGISTER:
Cvar_Register((vmCvar_t*)VMA(1), (char*)VMA(2), (char*)VMA(3), args[4]);
return 0;
case UI_CVAR_UPDATE:
Cvar_Update((vmCvar_t*)VMA(1));
return 0;
case UI_CVAR_SET:
Cvar_Set((char*)VMA(1), (char*)VMA(2));
return 0;
case UI_CVAR_VARIABLEVALUE:
return FloatAsInt(Cvar_VariableValue((char*)VMA(1)));
case UI_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer((char*)VMA(1), (char*)VMA(2), args[3]);
return 0;
case UI_CVAR_LATCHEDVARIABLESTRINGBUFFER:
Cvar_LatchedVariableStringBuffer((char*)VMA(1), (char*)VMA(2), args[3]);
return 0;
case UI_CVAR_SETVALUE:
Cvar_SetValue((char*)VMA(1), VMF(2));
return 0;
case UI_CVAR_RESET:
Cvar_Reset((char*)VMA(1));
return 0;
case UI_CVAR_CREATE:
Cvar_Get((char*)VMA(1), (char*)VMA(2), args[3], (char*)VMA(4));
return 0;
case UI_CVAR_INFOSTRINGBUFFER:
Cvar_InfoStringBuffer(args[1], (char*)VMA(2), args[3]);
return 0;
case UI_ARGC:
return Cmd_Argc();
case UI_ARGV:
Cmd_ArgvBuffer(args[1], (char*)VMA(2), args[3]);
return 0;
case UI_CMD_EXECUTETEXT:
Cbuf_ExecuteText(args[1], (char*)VMA(2));
return 0;
case UI_ADDCOMMAND:
Cmd_AddCommand((char*)VMA(1), NULL, (char*)VMA(3));
return 0;
case UI_FS_FOPENFILE:
return FS_FOpenFileByMode((char*)VMA(1), (fileHandle_t*)VMA( 2 ), (fsMode_t)args[3] );
case UI_FS_READ:
FS_Read2(VMA(1), args[2], args[3]);
return 0;
case UI_FS_WRITE:
FS_Write(VMA(1), args[2], args[3]);
return 0;
case UI_FS_FCLOSEFILE:
FS_FCloseFile(args[1]);
return 0;
case UI_FS_DELETEFILE:
return FS_Delete((char*)VMA(1));
case UI_FS_GETFILELIST:
return FS_GetFileList((char*)VMA(1), (char*)VMA(2), (char*)VMA(3), args[4]);
case UI_FS_SEEK:
return FS_Seek( args[1], args[2], args[3] );
case UI_R_REGISTERMODEL:
return re.RegisterModel((char*)VMA(1));
case UI_R_REGISTERSKIN:
return re.RegisterSkin((char*)VMA(1));
case UI_R_REGISTERSHADERNOMIP:
return re.RegisterShaderNoMip((char*)VMA(1));
case UI_R_CLEARSCENE:
re.ClearScene();
return 0;
case UI_R_ADDREFENTITYTOSCENE:
re.AddRefEntityToScene((refEntity_t*)VMA(1));
return 0;
case UI_R_ADDPOLYTOSCENE:
re.AddPolyToScene(args[1], args[2], (polyVert_t*)VMA(3));
return 0;
case UI_R_ADDPOLYSTOSCENE:
re.AddPolysToScene(args[1], args[2], (polyVert_t*)VMA(3), args[4]);
return 0;
case UI_R_ADDLIGHTTOSCENE:
re.AddLightToScene((vec_t*)VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), args[7], args[8]);
return 0;
case UI_R_ADDCORONATOSCENE:
re.AddCoronaToScene((vec_t*)VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), args[6], (bool)args[7]);
return 0;
case UI_R_RENDERSCENE:
re.RenderScene((refdef_t*)VMA(1));
//.........這裏部分代碼省略.........
示例7: CL_UISystemCalls
/*
====================
CL_UISystemCalls
The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls( intptr_t *args )
{
switch ( args[ 0 ] )
{
case UI_ERROR:
Com_Error( ERR_DROP, "%s", ( char * ) VMA( 1 ) );
case UI_PRINT:
Com_Printf( "%s", ( char * ) VMA( 1 ) );
return 0;
case UI_MILLISECONDS:
return Sys_Milliseconds();
case UI_CVAR_REGISTER:
Cvar_Register( VMA( 1 ), VMA( 2 ), VMA( 3 ), args[ 4 ] );
return 0;
case UI_CVAR_UPDATE:
Cvar_Update( VMA( 1 ) );
return 0;
case UI_CVAR_SET:
Cvar_Set( VMA( 1 ), VMA( 2 ) );
return 0;
case UI_CVAR_VARIABLEVALUE:
return FloatAsInt( Cvar_VariableValue( VMA( 1 ) ) );
case UI_CVAR_VARIABLESTRINGBUFFER:
VM_CheckBlock( args[2], args[3], "CVARVSB" );
Cvar_VariableStringBuffer( VMA( 1 ), VMA( 2 ), args[ 3 ] );
return 0;
case UI_CVAR_LATCHEDVARIABLESTRINGBUFFER:
VM_CheckBlock( args[2], args[3], "CVARLVSB" );
Cvar_LatchedVariableStringBuffer( VMA( 1 ), VMA( 2 ), args[ 3 ] );
return 0;
case UI_CVAR_SETVALUE:
Cvar_SetValue( VMA( 1 ), VMF( 2 ) );
return 0;
case UI_CVAR_RESET:
Cvar_Reset( VMA( 1 ) );
return 0;
case UI_CVAR_CREATE:
Cvar_Get( VMA( 1 ), VMA( 2 ), args[ 3 ] );
return 0;
case UI_CVAR_INFOSTRINGBUFFER:
VM_CheckBlock( args[2], args[3], "CVARISB" );
Cvar_InfoStringBuffer( args[ 1 ], VMA( 2 ), args[ 3 ] );
return 0;
case UI_ARGC:
return Cmd_Argc();
case UI_ARGV:
VM_CheckBlock( args[2], args[3], "ARGV" );
Cmd_ArgvBuffer( args[ 1 ], VMA( 2 ), args[ 3 ] );
return 0;
case UI_CMD_EXECUTETEXT:
Cbuf_ExecuteText( args[ 1 ], VMA( 2 ) );
return 0;
case UI_ADDCOMMAND:
Cmd_AddCommand( VMA( 1 ), NULL );
return 0;
case UI_FS_FOPENFILE:
return FS_FOpenFileByMode( VMA( 1 ), VMA( 2 ), args[ 3 ] );
case UI_FS_READ:
VM_CheckBlock( args[1], args[2], "FSREAD" );
FS_Read2( VMA( 1 ), args[ 2 ], args[ 3 ] );
return 0;
case UI_FS_WRITE:
VM_CheckBlock( args[1], args[2], "FSWRITE" );
FS_Write( VMA( 1 ), args[ 2 ], args[ 3 ] );
return 0;
case UI_FS_FCLOSEFILE:
FS_FCloseFile( args[ 1 ] );
return 0;
case UI_FS_DELETEFILE:
return FS_Delete( VMA( 1 ) );
case UI_FS_GETFILELIST:
//.........這裏部分代碼省略.........
示例8: SV_GameSystemCalls
//.........這裏部分代碼省略.........
case BOTLIB_PC_FREE_SOURCE:
return Parse_FreeSourceHandle(args[1]);
case BOTLIB_PC_READ_TOKEN:
return Parse_ReadTokenHandle(args[1], (pc_token_t*)VMA(2));
case BOTLIB_PC_SOURCE_FILE_AND_LINE:
return Parse_SourceFileAndLine(args[1], (char*)VMA(2), (int*)VMA(3));
case BOTLIB_PC_UNREAD_TOKEN:
Parse_UnreadLastTokenHandle(args[1]);
return 0;
case BOTLIB_START_FRAME:
return botlib_export->BotLibStartFrame(VMF(1));
case BOTLIB_LOAD_MAP:
return botlib_export->BotLibLoadMap((char*)VMA(1));
case BOTLIB_UPDATENTITY:
return botlib_export->BotLibUpdateEntity(args[1], (bot_entitystate_t*)VMA(2));
case BOTLIB_TEST:
return botlib_export->Test( args[1], (char*)VMA(2), (float*)VMA(3), (float*)VMA(4) );
case BOTLIB_GET_SNAPSHOT_ENTITY:
return SV_BotGetSnapshotEntity(args[1], args[2]);
case BOTLIB_GET_CONSOLE_MESSAGE:
return SV_BotGetConsoleMessage(args[1], (char*)VMA(2), args[3]);
case BOTLIB_USER_COMMAND:
SV_ClientThink(&svs.clients[args[1]], (usercmd_t*)VMA(2));
return 0;
case BOTLIB_AAS_ENTITY_INFO:
botlib_export->aas.AAS_EntityInfo(args[1], (aas_entityinfo_s*)VMA(2));
return 0;
case BOTLIB_AAS_INITIALIZED:
return botlib_export->aas.AAS_Initialized();
case BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX:
botlib_export->aas.AAS_PresenceTypeBoundingBox( args[1], (float*)VMA(2), (float*)VMA(3) );
return 0;
case BOTLIB_AAS_TIME:
return FloatAsInt(botlib_export->aas.AAS_Time());
case BOTLIB_AAS_SETCURRENTWORLD:
botlib_export->aas.AAS_SetCurrentWorld(args[1]);
return 0;
case BOTLIB_AAS_POINT_AREA_NUM:
return botlib_export->aas.AAS_PointAreaNum( (float*)VMA(1) );
case BOTLIB_AAS_TRACE_AREAS:
return botlib_export->aas.AAS_TraceAreas( (float*)VMA(1), (float*)VMA(2), (int*)VMA(3), (vec3_t*)VMA(4), args[5] );
case BOTLIB_AAS_BBOX_AREAS:
return botlib_export->aas.AAS_BBoxAreas( (float*)VMA(1), (float*)VMA(2), (int*)VMA(3), args[4] );
case BOTLIB_AAS_AREA_CENTER:
botlib_export->aas.AAS_AreaCenter(args[1], (float*)VMA(2));
return 0;
case BOTLIB_AAS_AREA_WAYPOINT:
return botlib_export->aas.AAS_AreaWaypoint(args[1], (float*)VMA(2));
case BOTLIB_AAS_POINT_CONTENTS:
return botlib_export->aas.AAS_PointContents((float*)VMA(1));
case BOTLIB_AAS_NEXT_BSP_ENTITY:
return botlib_export->aas.AAS_NextBSPEntity(args[1]);
case BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY:
return botlib_export->aas.AAS_ValueForBSPEpairKey(args[1], (char*)VMA(2), (char*)VMA(3), args[4]);
case BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY:
return botlib_export->aas.AAS_VectorForBSPEpairKey(args[1], (char*)VMA(2), (float*)VMA(3));
case BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY:
return botlib_export->aas.AAS_FloatForBSPEpairKey(args[1], (char*)VMA(2), (float*)VMA(3));
case BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY:
return botlib_export->aas.AAS_IntForBSPEpairKey(args[1], (char*)VMA(2), (int*)VMA(3));
case BOTLIB_AAS_AREA_REACHABILITY:
return botlib_export->aas.AAS_AreaReachability(args[1]);
case BOTLIB_AAS_AREA_LADDER:
return botlib_export->aas.AAS_AreaLadder(args[1]);
case BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA:
return botlib_export->aas.AAS_AreaTravelTimeToGoalArea(args[1], (float*)VMA(2), args[3], args[4]);
示例9: CL_UISystemCalls
/**
* @brief The ui module is making a system call
* @param[in] args
* @return
*/
intptr_t CL_UISystemCalls(intptr_t *args)
{
switch (args[0])
{
case UI_ERROR:
Com_Error(ERR_DROP, "%s", (char *)VMA(1));
case UI_PRINT:
Com_Printf("%s", (char *)VMA(1));
return 0;
case UI_MILLISECONDS:
return Sys_Milliseconds();
case UI_CVAR_REGISTER:
Cvar_Register(VMA(1), VMA(2), VMA(3), args[4]);
return 0;
case UI_CVAR_UPDATE:
Cvar_Update(VMA(1));
return 0;
case UI_CVAR_SET:
Cvar_SetSafe(VMA(1), VMA(2));
return 0;
case UI_CVAR_VARIABLEVALUE:
return FloatAsInt(Cvar_VariableValue(VMA(1)));
case UI_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer(VMA(1), VMA(2), args[3]);
return 0;
case UI_CVAR_LATCHEDVARIABLESTRINGBUFFER:
Cvar_LatchedVariableStringBuffer(VMA(1), VMA(2), args[3]);
return 0;
case UI_CVAR_SETVALUE:
Cvar_SetValueSafe(VMA(1), VMF(2));
return 0;
case UI_CVAR_RESET:
Cvar_Reset(VMA(1));
return 0;
case UI_CVAR_CREATE:
Cvar_Register(NULL, VMA(1), VMA(2), args[3]);
return 0;
case UI_CVAR_INFOSTRINGBUFFER:
Cvar_InfoStringBuffer(args[1], VMA(2), args[3]);
return 0;
case UI_ARGC:
return Cmd_Argc();
case UI_ARGV:
Cmd_ArgvBuffer(args[1], VMA(2), args[3]);
return 0;
case UI_CMD_EXECUTETEXT:
if (args[1] == EXEC_NOW
&& (!strncmp(VMA(2), "snd_restart", 11)
|| !strncmp(VMA(2), "vid_restart", 11)
|| !strncmp(VMA(2), "quit", 5)))
{
Com_Printf(S_COLOR_YELLOW "turning EXEC_NOW '%.11s' into EXEC_INSERT\n", (const char *)VMA(2));
args[1] = EXEC_INSERT;
}
Cbuf_ExecuteText(args[1], VMA(2));
return 0;
case UI_ADDCOMMAND:
Cmd_AddCommand(VMA(1));
return 0;
case UI_FS_FOPENFILE:
return FS_FOpenFileByMode(VMA(1), VMA(2), (fsMode_t)args[3]);
case UI_FS_READ:
FS_Read(VMA(1), args[2], args[3]);
return 0;
case UI_FS_WRITE:
FS_Write(VMA(1), args[2], args[3]);
return 0;
case UI_FS_FCLOSEFILE:
FS_FCloseFile(args[1]);
return 0;
case UI_FS_DELETEFILE:
return FS_Delete(VMA(1));
case UI_FS_GETFILELIST:
return FS_GetFileList(VMA(1), VMA(2), VMA(3), args[4]);
case UI_R_REGISTERMODEL:
return re.RegisterModel(VMA(1));
case UI_R_REGISTERSKIN:
return re.RegisterSkin(VMA(1));
case UI_R_REGISTERSHADERNOMIP:
return re.RegisterShaderNoMip(VMA(1));
case UI_R_CLEARSCENE:
re.ClearScene();
return 0;
case UI_R_ADDREFENTITYTOSCENE:
re.AddRefEntityToScene(VMA(1));
return 0;
case UI_R_ADDPOLYTOSCENE:
re.AddPolyToScene(args[1], args[2], VMA(3));
return 0;
case UI_R_ADDPOLYSTOSCENE:
re.AddPolysToScene(args[1], args[2], VMA(3), args[4]);
return 0;
case UI_R_ADDLIGHTTOSCENE:
// new dlight code
re.AddLightToScene(VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), args[7], args[8]);
//.........這裏部分代碼省略.........
示例10: CL_CgameSystemCalls
//.........這裏部分代碼省略.........
case CG_KEY_KEYNUMTOSTRINGBUF:
Key_KeynumToStringBuf( args[1], (char*)VMA(2), args[3] );
return 0;
case CG_KEY_GETBINDINGBUF:
Key_GetBindingBuf( args[1], (char*)VMA(2), args[3] );
return 0;
case CG_KEY_SETBINDING:
Key_SetBinding( args[1], (const char*)VMA(2) );
return 0;
case CG_PARSE_ADD_GLOBAL_DEFINE:
return Parse_AddGlobalDefine( (char*)VMA(1) );
case CG_PARSE_LOAD_SOURCE:
return Parse_LoadSourceHandle( (const char*)VMA(1) );
case CG_PARSE_FREE_SOURCE:
return Parse_FreeSourceHandle( args[1] );
case CG_PARSE_READ_TOKEN:
return Parse_ReadTokenHandle( args[1], (pc_token_t*)VMA(2) );
case CG_PARSE_SOURCE_FILE_AND_LINE:
return Parse_SourceFileAndLine( args[1], (char*)VMA(2), (int*)VMA(3) );
case CG_KEY_SETOVERSTRIKEMODE:
Key_SetOverstrikeMode( (bool)args[1] );
return 0;
case CG_KEY_GETOVERSTRIKEMODE:
return Key_GetOverstrikeMode( );
case CG_FIELD_COMPLETELIST:
Field_CompleteList( (char*)VMA(1) );
return 0;
case CG_MEMSET:
::memset( VMA(1), args[2], args[3] );
return 0;
case CG_MEMCPY:
::memcpy( VMA(1), VMA(2), args[3] );
return 0;
case CG_STRNCPY:
safe_strncpy( (char*)VMA(1), (const char*)VMA(2), args[3] );
return args[1];
case CG_SIN:
return FloatAsInt( sin( VMF(1) ) );
case CG_COS:
return FloatAsInt( cos( VMF(1) ) );
case CG_ATAN2:
return FloatAsInt( atan2( VMF(1), VMF(2) ) );
case CG_SQRT:
return FloatAsInt( sqrt( VMF(1) ) );
case CG_FLOOR:
return FloatAsInt( floor( VMF(1) ) );
case CG_CEIL:
return FloatAsInt( ceil( VMF(1) ) );
case CG_ACOS:
return FloatAsInt( Q_acos( VMF(1) ) );
case CG_S_STOPBACKGROUNDTRACK:
S_StopBackgroundTrack();
return 0;
case CG_REAL_TIME:
return Com_RealTime( (qtime_t*)VMA(1) );
case CG_SNAPVECTOR:
Q_SnapVector((float*)VMA(1));
return 0;
case CG_CIN_PLAYCINEMATIC:
return CIN_PlayCinematic((const char*)VMA(1), args[2], args[3], args[4], args[5], args[6]);
case CG_CIN_STOPCINEMATIC:
return CIN_StopCinematic(args[1]);
case CG_CIN_RUNCINEMATIC:
return CIN_RunCinematic(args[1]);
case CG_CIN_DRAWCINEMATIC:
CIN_DrawCinematic(args[1]);
return 0;
case CG_CIN_SETEXTENTS:
CIN_SetExtents(args[1], args[2], args[3], args[4], args[5]);
return 0;
case CG_R_REMAP_SHADER:
re.RemapShader( (const char*)VMA(1), (const char*)VMA(2), (const char*)VMA(3) );
return 0;
case CG_GET_ENTITY_TOKEN:
return re.GetEntityToken( (char*)VMA(1), args[2] );
case CG_R_INPVS:
return re.inPVS( (const float*)VMA(1), (const float*)VMA(2) );
default:
assert(0);
Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] );
}
return 0;
}
示例11: CL_UISystemCalls
/*
====================
CL_UISystemCalls
The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls( intptr_t *args ) {
switch( args[0] ) {
case UI_ERROR:
Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
return 0;
case UI_PRINT:
Com_Printf( "%s", (const char*)VMA(1) );
return 0;
case UI_MILLISECONDS:
return Sys_Milliseconds();
case UI_CVAR_REGISTER:
Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] );
return 0;
case UI_CVAR_UPDATE:
Cvar_Update( VMA(1) );
return 0;
case UI_CVAR_SET:
Cvar_SetSafe( VMA(1), VMA(2) );
return 0;
case UI_CVAR_VARIABLEVALUE:
return FloatAsInt( Cvar_VariableValue( VMA(1) ) );
case UI_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
return 0;
case UI_CVAR_SETVALUE:
Cvar_SetValueSafe( VMA(1), VMF(2) );
return 0;
case UI_CVAR_RESET:
Cvar_Reset( VMA(1) );
return 0;
case UI_CVAR_CREATE:
Cvar_Get( VMA(1), VMA(2), args[3] );
return 0;
case UI_CVAR_INFOSTRINGBUFFER:
Cvar_InfoStringBuffer( args[1], VMA(2), args[3] );
return 0;
case UI_ARGC:
return Cmd_Argc();
case UI_ARGV:
Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
return 0;
case UI_CMD_EXECUTETEXT:
if(args[1] == EXEC_NOW
&& (!strncmp(VMA(2), "snd_restart", 11)
|| !strncmp(VMA(2), "vid_restart", 11)
|| !strncmp(VMA(2), "quit", 5)))
{
Com_Printf (S_COLOR_YELLOW "turning EXEC_NOW '%.11s' into EXEC_INSERT\n", (const char*)VMA(2));
args[1] = EXEC_INSERT;
}
Cbuf_ExecuteText( args[1], VMA(2) );
return 0;
case UI_FS_FOPENFILE:
return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );
case UI_FS_READ:
FS_Read2( VMA(1), args[2], args[3] );
return 0;
case UI_FS_WRITE:
FS_Write( VMA(1), args[2], args[3] );
return 0;
case UI_FS_FCLOSEFILE:
FS_FCloseFile( args[1] );
return 0;
case UI_FS_GETFILELIST:
return FS_GetFileList( VMA(1), VMA(2), VMA(3), args[4] );
case UI_R_REGISTERMODEL:
return re.RegisterModel( VMA(1) );
case UI_R_REGISTERSKIN:
return re.RegisterSkin( VMA(1) );
case UI_R_REGISTERSHADERNOMIP:
return re.RegisterShaderNoMip( VMA(1) );
//.........這裏部分代碼省略.........
示例12: CL_CgameSystemCalls
//.........這裏部分代碼省略.........
case CG_GETSERVERCOMMAND:
return CL_GetServerCommand( args[1] );
case CG_GETCURRENTCMDNUMBER:
return CL_GetCurrentCmdNumber();
case CG_GETUSERCMD:
return CL_GetUserCmd( args[1], VMA(2) );
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue( args[1], VMF(2) );
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown( args[1] );
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
Key_SetCatcher( args[1] );
return 0;
case CG_KEY_GETKEY:
return Key_GetKey( VMA(1) );
case CG_MEMSET:
Com_Memset( VMA(1), args[2], args[3] );
return 0;
case CG_MEMCPY:
Com_Memcpy( VMA(1), VMA(2), args[3] );
return 0;
case CG_STRNCPY:
strncpy( VMA(1), VMA(2), args[3] );
return args[1];
case CG_SIN:
return FloatAsInt( sin( VMF(1) ) );
case CG_COS:
return FloatAsInt( cos( VMF(1) ) );
case CG_ATAN2:
return FloatAsInt( atan2( VMF(1), VMF(2) ) );
case CG_SQRT:
return FloatAsInt( sqrt( VMF(1) ) );
case CG_FLOOR:
return FloatAsInt( floor( VMF(1) ) );
case CG_CEIL:
return FloatAsInt( ceil( VMF(1) ) );
case CG_ACOS: return FloatAsInt( Q_acos( VMF(1) ) );
case CG_FMOD: return FloatAsInt( fmod( VMF(1),VMF(2) ) );
case CG_POW: return FloatAsInt( pow( VMF(1),VMF(2) ) );
case CG_ATAN: return FloatAsInt( atan( VMF(1) ) );
case CG_TAN: return FloatAsInt( tan( VMF(1)) );
case CG_PC_ADD_GLOBAL_DEFINE:
return botlib_export->PC_AddGlobalDefine( VMA(1) );
case CG_PC_LOAD_SOURCE:
return botlib_export->PC_LoadSourceHandle( VMA(1) );
case CG_PC_FREE_SOURCE:
return botlib_export->PC_FreeSourceHandle( args[1] );
case CG_PC_READ_TOKEN:
return botlib_export->PC_ReadTokenHandle( args[1], VMA(2) );
case CG_PC_SOURCE_FILE_AND_LINE:
return botlib_export->PC_SourceFileAndLine( args[1], VMA(2), VMA(3) );
case CG_S_STOPBACKGROUNDTRACK:
S_StopBackgroundTrack();
return 0;
case CG_REAL_TIME:
示例13: CL_CgameSystemCalls
//.........這裏部分代碼省略.........
return CL_GetServerCommand( args[1] );
case CG_GETCURRENTCMDNUMBER:
return CL_GetCurrentCmdNumber();
case CG_GETUSERCMD:
return CL_GetUserCmd( args[1], VMA(2) );
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue( args[1], VMF(2) );
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown( args[1] );
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
// Don't allow the cgame module to close the console
Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) );
return 0;
case CG_KEY_GETKEY:
return Key_GetKey( VMA(1) );
case CG_MEMSET:
Com_Memset( VMA(1), args[2], args[3] );
return 0;
case CG_MEMCPY:
Com_Memcpy( VMA(1), VMA(2), args[3] );
return 0;
case CG_STRNCPY:
strncpy( VMA(1), VMA(2), args[3] );
return args[1];
case CG_SIN:
return FloatAsInt( sin( VMF(1) ) );
case CG_COS:
return FloatAsInt( cos( VMF(1) ) );
case CG_ATAN2:
return FloatAsInt( atan2( VMF(1), VMF(2) ) );
case CG_SQRT:
return FloatAsInt( sqrt( VMF(1) ) );
case CG_FLOOR:
return FloatAsInt( floor( VMF(1) ) );
case CG_CEIL:
return FloatAsInt( ceil( VMF(1) ) );
case CG_ACOS:
return FloatAsInt( Q_acos( VMF(1) ) );
case CG_PC_ADD_GLOBAL_DEFINE:
return botlib_export->PC_AddGlobalDefine( VMA(1) );
case CG_PC_LOAD_SOURCE:
return botlib_export->PC_LoadSourceHandle( VMA(1) );
case CG_PC_FREE_SOURCE:
return botlib_export->PC_FreeSourceHandle( args[1] );
case CG_PC_READ_TOKEN:
return botlib_export->PC_ReadTokenHandle( args[1], VMA(2) );
case CG_PC_SOURCE_FILE_AND_LINE:
return botlib_export->PC_SourceFileAndLine( args[1], VMA(2), VMA(3) );
case CG_S_STOPBACKGROUNDTRACK:
S_StopBackgroundTrack();
return 0;
case CG_REAL_TIME:
return Com_RealTime( VMA(1) );
case CG_SNAPVECTOR:
Sys_SnapVector( VMA(1) );
示例14: CL_CgameSystemCalls
//.........這裏部分代碼省略.........
case CG_GETUSERCMD:
return CL_GetUserCmd( args[1], VMA( 2 ) );
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue( args[1], args[2], VMF( 3 ), args[4], args[5] );
return 0;
case CG_SETCLIENTLERPORIGIN:
CL_SetClientLerpOrigin( VMF( 1 ), VMF( 2 ), VMF( 3 ) );
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown( args[1] );
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
// Don't allow the cgame module to close the console
Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) );
return 0;
case CG_KEY_GETKEY:
return Key_GetKey( VMA( 1 ) );
case CG_MEMSET:
Com_Memset( VMA(1), args[2], args[3] );
return args[1];
case CG_MEMCPY:
Com_Memcpy( VMA(1), VMA(2), args[3] );
return args[1];
case CG_STRNCPY:
strncpy( VMA(1), VMA(2), args[3] );
return args[1];
case CG_SIN:
return FloatAsInt( sin( VMF( 1 ) ) );
case CG_COS:
return FloatAsInt( cos( VMF( 1 ) ) );
case CG_ATAN2:
return FloatAsInt( atan2( VMF( 1 ), VMF( 2 ) ) );
case CG_SQRT:
return FloatAsInt( sqrt( VMF( 1 ) ) );
case CG_FLOOR:
return FloatAsInt( floor( VMF( 1 ) ) );
case CG_CEIL:
return FloatAsInt( ceil( VMF( 1 ) ) );
case CG_ACOS:
return FloatAsInt( Q_acos( VMF( 1 ) ) );
case CG_PC_ADD_GLOBAL_DEFINE:
return botlib_export->PC_AddGlobalDefine( VMA( 1 ) );
case CG_PC_LOAD_SOURCE:
return botlib_export->PC_LoadSourceHandle( VMA( 1 ) );
case CG_PC_FREE_SOURCE:
return botlib_export->PC_FreeSourceHandle( args[1] );
case CG_PC_READ_TOKEN:
return botlib_export->PC_ReadTokenHandle( args[1], VMA( 2 ) );
case CG_PC_SOURCE_FILE_AND_LINE:
return botlib_export->PC_SourceFileAndLine( args[1], VMA( 2 ), VMA( 3 ) );
case CG_S_STOPBACKGROUNDTRACK:
S_StopBackgroundTrack();
return 0;
case CG_REAL_TIME:
return Com_RealTime( VMA( 1 ) );
case CG_SNAPVECTOR:
Q_SnapVector(VMA(1));
示例15: CL_UISystemCalls
/*
====================
CL_UISystemCalls
The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls( intptr_t *args )
{
switch( args[0] )
{
case UI_ERROR:
Com_Error( ERR_DROP, "%s", VMA(1) );
return 0;
case UI_CVAR_REGISTER:
Cvar_Register( (vmCvar_t *)VMA(1),(const char *) VMA(2),(const char *) VMA(3), args[4] );
return 0;
case UI_CVAR_SET:
Cvar_Set( (const char *) VMA(1), (const char *) VMA(2) );
return 0;
case UI_CVAR_SETVALUE:
Cvar_SetValue( (const char *) VMA(1), VMF(2) );
return 0;
case UI_CVAR_UPDATE:
Cvar_Update( (vmCvar_t *) VMA(1) );
return 0;
case UI_R_REGISTERMODEL:
return re.RegisterModel((const char *) VMA(1) );
case UI_R_REGISTERSHADERNOMIP:
return re.RegisterShaderNoMip((const char *) VMA(1) );
case UI_GETGLCONFIG:
CL_GetGlconfig( ( glconfig_t *) VMA(1) );
return 0;
case UI_CMD_EXECUTETEXT:
Cbuf_ExecuteText( args[1], (const char *) VMA(2) );
return 0;
case UI_CVAR_VARIABLEVALUE:
return FloatAsInt( Cvar_VariableValue( (const char *) VMA(1) ) );
case UI_FS_GETFILELIST:
return FS_GetFileList( (const char *) VMA(1), (const char *) VMA(2), (char *) VMA(3), args[4] );
case UI_KEY_SETCATCHER:
Key_SetCatcher( args[1] );
return 0;
case UI_KEY_CLEARSTATES:
Key_ClearStates();
return 0;
case UI_R_SETCOLOR:
re.SetColor( (const float *) VMA(1) );
return 0;
case UI_R_DRAWSTRETCHPIC:
re.DrawStretchPic( VMF(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), VMF(7), VMF(8), args[9] );
return 0;
case UI_CVAR_VARIABLESTRINGBUFFER:
Cvar_VariableStringBuffer( (const char *) VMA(1), (char *) VMA(2), args[3] );
return 0;
case UI_R_MODELBOUNDS:
re.ModelBounds( args[1], (float *) VMA(2),(float *) VMA(3) );
return 0;
case UI_R_CLEARSCENE:
re.ClearScene();
return 0;
// case UI_KEY_GETOVERSTRIKEMODE:
// return Key_GetOverstrikeMode();
// return 0;
// case UI_PC_READ_TOKEN:
// return PC_ReadTokenHandle( args[1], VMA(2) );
// case UI_PC_SOURCE_FILE_AND_LINE:
// return PC_SourceFileAndLine( args[1], VMA(2), VMA(3) );
case UI_KEY_GETCATCHER:
return Key_GetCatcher();
case UI_MILLISECONDS:
return Sys_Milliseconds();
case UI_S_REGISTERSOUND:
return S_RegisterSound((const char *) VMA(1));
case UI_S_STARTLOCALSOUND:
//.........這裏部分代碼省略.........