本文整理汇总了C++中CG_CrosshairPlayer函数的典型用法代码示例。如果您正苦于以下问题:C++ CG_CrosshairPlayer函数的具体用法?C++ CG_CrosshairPlayer怎么用?C++ CG_CrosshairPlayer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CG_CrosshairPlayer函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vmMain
/*
================
vmMain
This is the only way control passes into the module.
This must be the very first function compiled into the .q3vm file
================
*/
Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
switch ( command ) {
case CG_INIT:
CG_Init( arg0, arg1, arg2 );
return 0;
case CG_SHUTDOWN:
CG_Shutdown();
return 0;
case CG_CONSOLE_COMMAND:
return CG_ConsoleCommand();
case CG_DRAW_ACTIVE_FRAME:
CG_DrawActiveFrame( arg0, arg1, arg2 );
return 0;
case CG_CROSSHAIR_PLAYER:
return CG_CrosshairPlayer();
case CG_LAST_ATTACKER:
return CG_LastAttacker();
case CG_KEY_EVENT:
CG_KeyEvent(arg0, arg1);
return 0;
case CG_MOUSE_EVENT:
CG_MouseEvent(arg0, arg1);
return 0;
case CG_EVENT_HANDLING:
CG_EventHandling(arg0);
return 0;
default:
CG_Error( "vmMain: unknown command %i", command );
break;
}
return -1;
}
示例2: CG_MessageMode3_f
/*
================
CG_MessageMode3_f
================
*/
void CG_MessageMode3_f( void ) {
int playerNum = CG_CrosshairPlayer( 0 );
if ( playerNum < 0 || playerNum >= MAX_CLIENTS ) {
return;
}
Com_sprintf( cg.messageCommand, sizeof (cg.messageCommand), "tell %d", playerNum );
Com_sprintf( cg.messagePrompt, sizeof (cg.messagePrompt), "Tell %s:", cgs.playerinfo[ playerNum ].name );
MField_Clear( &cg.messageField );
cg.messageField.widthInChars = 30;
Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
}
示例3: CG_TaskSuicide_f
static void CG_TaskSuicide_f (void ) {
int clientNum;
char command[128];
clientNum = CG_CrosshairPlayer();
if ( clientNum == -1 ) {
return;
}
Com_sprintf( command, 128, "tell %i suicide", clientNum );
trap_SendClientCommand( command );
}
示例4: CG_TargetCommand_f
void CG_TargetCommand_f( void ) {
int targetNum;
char test[4];
targetNum = CG_CrosshairPlayer();
if ( targetNum == -1 ) {
return;
}
trap_Argv( 1, test, 4 );
trap_SendClientCommand( va( "gc %i %i", targetNum, atoi( test ) ) );
}
示例5: CG_TaskSuicide_f
static void CG_TaskSuicide_f( int localPlayerNum ) {
int playerNum;
char command[128];
playerNum = CG_CrosshairPlayer(0);
if ( playerNum == -1 ) {
return;
}
Com_sprintf( command, 128, "%s %i suicide", Com_LocalPlayerCvarName( localPlayerNum, "tell" ), playerNum );
trap_SendClientCommand( command );
}
示例6: CG_TargetCommand_f
void CG_TargetCommand_f( int localPlayerNum ) {
int targetNum;
char test[4];
targetNum = CG_CrosshairPlayer( localPlayerNum );
if ( targetNum == -1 ) {
return;
}
trap_Argv( 1, test, 4 );
trap_SendClientCommand( va( "%s %i %i", Com_LocalPlayerCvarName( localPlayerNum, "gc" ), targetNum, atoi( test ) ) );
}
示例7: CG_TargetCommand_f
void CG_TargetCommand_f( void ) {
int targetNum;
char test[4];
targetNum = CG_CrosshairPlayer();
if (!targetNum ) {
return;
}
Cmd_ArgvBuffer( 1, test, 4 );
Cbuf_AddText( va( "gc %i %i", targetNum, atoi( test ) ) );
}
示例8: CG_TellTarget_f
static void CG_TellTarget_f( void ) {
int clientNum;
char command[128];
char message[128];
clientNum = CG_CrosshairPlayer();
if ( clientNum == -1 )
return;
trap->Cmd_Args( message, sizeof(message) );
Com_sprintf( command, sizeof(command), "tell %i %s", clientNum, message );
trap->SendClientCommand( command );
}
示例9: CG_VoiceTellTarget_f
static void CG_VoiceTellTarget_f( void ) {
int clientNum;
char command[128];
char message[128];
clientNum = CG_CrosshairPlayer();
if ( clientNum == -1 ) {
return;
}
trap_Args( message, 128 );
Com_sprintf( command, 128, "vtell %i %s", clientNum, message );
trap_SendClientCommand( command );
}
示例10: CG_VoiceTellTarget_f
static void CG_VoiceTellTarget_f( int localPlayerNum ) {
int playerNum;
char command[128];
char message[128];
playerNum = CG_CrosshairPlayer( localPlayerNum );
if ( playerNum == -1 ) {
return;
}
trap_Args( message, 128 );
Com_sprintf( command, 128, "%s %i %s", Com_LocalPlayerCvarName( localPlayerNum, "vtell" ), playerNum, message );
trap_SendClientCommand( command );
}
示例11: CG_TellTarget_f
static void CG_TellTarget_f( void ) {
int clientNum;
char command[128];
char message[128];
clientNum = CG_CrosshairPlayer();
if ( clientNum == -1 ) {
return;
}
Cmd_ArgsBuffer( message, 128 );
Com_sprintf( command, 128, "tell %i %s", clientNum, message );
CL_AddReliableCommand( command );
}
示例12: vmMain
/*
================
vmMain
This is the only way control passes into the module.
This must be the very first function compiled into the .q3vm file
================
*/
intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
switch ( command ) {
case CG_INIT:
CG_Init( arg0, arg1, arg2, arg3 );
return 0;
case CG_SHUTDOWN:
CG_Shutdown();
return 0;
case CG_CONSOLE_COMMAND:
return CG_ConsoleCommand();
case CG_DRAW_ACTIVE_FRAME:
CG_DrawActiveFrame( arg0, arg1, arg2 );
return 0;
case CG_DRAW_2D:
CG_Draw2D( arg0, arg1, arg2 );
return 0;
case CG_CROSSHAIR_PLAYER:
return CG_CrosshairPlayer();
case CG_LAST_ATTACKER:
return CG_LastAttacker();
case CG_KEY_EVENT:
CG_KeyEvent(arg0, arg1);
return 0;
case CG_MOUSE_EVENT:
CG_MouseEvent(arg0, arg1);
return 0;
case CG_EVENT_HANDLING:
CG_EventHandling(arg0);
return 0;
case CG_CENTERPRINT:
CG_CenterPrint( (const char*)arg0, 200, 10 );
return 0;
case CG_LOCATIONPRINT:
CG_LocationPrint( (const char*)arg0, arg1, arg2, 10 );
return 0;
case CG_PARSEMSG:
CG_ParseCGMessage();
return 0;
default:
CG_Error( "vmMain: unknown command %i", command );
break;
}
return -1;
}
示例13: switch
void VM::VMHandleSyscall(uint32_t id, Util::Reader reader) {
int major = id >> 16;
int minor = id & 0xffff;
if (major == VM::QVM) {
switch (minor) {
case CG_STATIC_INIT:
IPC::HandleMsg<CGameStaticInitMsg>(VM::rootChannel, std::move(reader), [] (int milliseconds) {
VM::InitializeProxies(milliseconds);
FS::Initialize();
srand(time(nullptr));
cmdBuffer.Init();
});
break;
case CG_INIT:
IPC::HandleMsg<CGameInitMsg>(VM::rootChannel, std::move(reader), [] (int serverMessageNum, int clientNum, glconfig_t gl, GameStateCSs gamestate) {
CG_Init(serverMessageNum, clientNum, gl, gamestate);
cmdBuffer.TryFlush();
});
break;
case CG_SHUTDOWN:
IPC::HandleMsg<CGameShutdownMsg>(VM::rootChannel, std::move(reader), [] {
CG_Shutdown();
});
break;
case CG_ROCKET_VM_INIT:
IPC::HandleMsg<CGameRocketInitMsg>(VM::rootChannel, std::move(reader), [] (glconfig_t gl) {
CG_Rocket_Init(gl);
});
break;
case CG_ROCKET_FRAME:
IPC::HandleMsg<CGameRocketFrameMsg>(VM::rootChannel, std::move(reader), [] (cgClientState_t cs) {
CG_Rocket_Frame(cs);
cmdBuffer.TryFlush();
});
break;
case CG_DRAW_ACTIVE_FRAME:
IPC::HandleMsg<CGameDrawActiveFrameMsg>(VM::rootChannel, std::move(reader), [] (int serverTime, bool demoPlayback) {
CG_DrawActiveFrame(serverTime, demoPlayback);
cmdBuffer.TryFlush();
});
break;
case CG_CROSSHAIR_PLAYER:
IPC::HandleMsg<CGameCrosshairPlayerMsg>(VM::rootChannel, std::move(reader), [] (int& player) {
player = CG_CrosshairPlayer();
});
break;
case CG_KEY_EVENT:
IPC::HandleMsg<CGameKeyEventMsg>(VM::rootChannel, std::move(reader), [] (int key, bool down) {
CG_KeyEvent(key, down);
cmdBuffer.TryFlush();
});
break;
case CG_MOUSE_EVENT:
IPC::HandleMsg<CGameMouseEventMsg>(VM::rootChannel, std::move(reader), [] (int dx, int dy) {
CG_MouseEvent(dx, dy);
cmdBuffer.TryFlush();
});
break;
case CG_MOUSE_POS_EVENT:
IPC::HandleMsg<CGameMousePosEventMsg>(VM::rootChannel, std::move(reader), [] (int x, int y) {
CG_MousePosEvent(x, y);
cmdBuffer.TryFlush();
});
break;
case CG_TEXT_INPUT_EVENT:
IPC::HandleMsg<CGameTextInptEvent>(VM::rootChannel, std::move(reader), [] (int c) {
Rocket_ProcessTextInput(c);
cmdBuffer.TryFlush();
});
break;
case CG_CONSOLE_LINE:
IPC::HandleMsg<CGameConsoleLineMsg>(VM::rootChannel, std::move(reader), [](std::string str) {
Rocket_AddConsoleText( str );
cmdBuffer.TryFlush();
});
break;
default:
CG_Error("VMMain(): unknown cgame command %i", minor);
}
} else if (major < VM::LAST_COMMON_SYSCALL) {
VM::HandleCommonSyscall(major, minor, std::move(reader), VM::rootChannel);
} else {
CG_Error("unhandled VM major syscall number %i", major);
}
}