本文整理匯總了C++中AP函數的典型用法代碼示例。如果您正苦於以下問題:C++ AP函數的具體用法?C++ AP怎麽用?C++ AP使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AP函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: G_MapRestart_v
// *** Map Restart ***
int G_MapRestart_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
// Vote request (vote is being initiated)
if (arg)
{
if (trap_Argc() > 2)
{
if (!Q_stricmp(arg2, "?"))
{
G_refPrintf(ent, "Usage: ^3%s %s%s\n", ((fRefereeCmd) ? "\\ref" : "\\callvote"), arg, aVoteInfo[dwVoteIndex].pszVoteHelp);
return G_INVALID;
}
}
// Vote action (vote has passed)
}
else
{
// Restart the map back to warmup
Svcmd_ResetMatch_f(qfalse, qtrue);
AP("cp \"^1*** Level Restarted! ***\n\"");
}
return G_OK;
}
示例2: includePointTriangle
// Checks whether 3D points p lies inside or outside of the triangle ABC
bool includePointTriangle(Vec3r& P,
Vec3r& A,
Vec3r& B,
Vec3r& C) {
Vec3r AB(B - A);
Vec3r BC(C - B);
Vec3r CA(A - C);
Vec3r AP(P - A);
Vec3r BP(P - B);
Vec3r CP(P - C);
Vec3r N(AB ^ BC); // triangle's normal
N.normalize();
Vec3r J(AB ^ AP), K(BC ^ BP), L(CA ^ CP);
J.normalize();
K.normalize();
L.normalize();
if(J * N < 0)
return false; // on the right of AB
if(K * N < 0)
return false; // on the right of BC
if(L * N < 0)
return false; // on the right of CA
return true;
}
示例3: G_Pub_v
// *** Load public settings for current mode ***
int G_Pub_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
// Vote request (vote is being initiated)
if (arg)
{
if (trap_Argc() > 2)
{
G_refPrintf(ent, "Usage: ^3%s %s%s\n", ((fRefereeCmd) ? "\\ref" : "\\callvote"), arg, aVoteInfo[dwVoteIndex].pszVoteHelp);
return(G_INVALID);
}
else if (vote_allow_pub.integer <= 0 && ent && !ent->client->sess.referee)
{
G_voteDisableMessage(ent, arg);
return(G_INVALID);
}
// Vote action (vote has passed)
}
else
{
// Load in pub settings for current gametype
G_configSet(g_gametype.integer, qfalse);
AP("cpm \"Public Settings Loaded!\n\"");
}
return(G_OK);
}
示例4: G_MatchReset_v
// *** Match Restart ***
int G_MatchReset_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
// Vote request (vote is being initiated)
if (arg)
{
if (!vote_allow_matchreset.integer && ent && !ent->client->sess.referee)
{
G_voteDisableMessage(ent, arg);
return(G_INVALID);
}
else if (trap_Argc() != 2 && G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
{
return(G_INVALID);
}
// Vote action (vote has passed)
}
else
{
// Restart the map back to warmup
Svcmd_ResetMatch_f(qtrue, qtrue);
AP("cp \"^1*** Match Reset! ***\n\"");
}
return(G_OK);
}
示例5: G_Referee_v
// *** Referee voting ***
int G_Referee_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
// Vote request (vote is being initiated)
if(arg) {
int pid;
if(!vote_allow_referee.integer && ent && !ent->client->sess.referee) {
G_voteDisableMessage(ent, arg);
return(G_INVALID);
}
if(!ent->client->sess.referee && level.numPlayingClients < 3) {
G_refPrintf(ent, "Sorry, not enough clients in the game to vote for a referee");
return(G_INVALID);
}
if(ent->client->sess.referee && trap_Argc() == 2) {
G_playersMessage(ent);
return(G_INVALID);
} else if(trap_Argc() == 2) pid = ent - g_entities;
else if(G_voteDescription(ent, fRefereeCmd, dwVoteIndex)) return(G_INVALID);
else if((pid = ClientNumberFromString(ent, arg2)) == -1) return(G_INVALID);
if(level.clients[pid].sess.referee) {
G_refPrintf(ent, "[lof]%s [lon]is already a referee!", level.clients[pid].pers.netname);
return(-1);
}
Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid);
Com_sprintf(arg2, VOTE_MAXSTRING, "%s", level.clients[pid].pers.netname);
// Vote action (vote has passed)
} else {
// Voting in a new referee
gclient_t *cl = &level.clients[atoi(level.voteInfo.vote_value)];
if(cl->pers.connected == CON_DISCONNECTED) {
AP("print \"Player left before becoming referee\n\"");
} else {
cl->sess.referee = RL_REFEREE; // FIXME: Differentiate voted refs from passworded refs
cl->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES;
AP(va("cp \"%s^7 is now a referee\n\"", cl->pers.netname));
ClientUserinfoChanged( atoi(level.voteInfo.vote_value) );
}
}
return(G_OK);
}
示例6: G_ready_cmd
// ************** READY / NOTREADY
//
// Sets a player's "ready" status.
void G_ready_cmd( gentity_t *ent, unsigned int dwCommand, qboolean state ) {
char *status[2] = { " NOT", "" };
if ( g_gamestate.integer == GS_PLAYING || g_gamestate.integer == GS_INTERMISSION ) {
CP( "cpm \"Match is already in progress!\n\"" );
return;
}
if ( !state && g_gamestate.integer == GS_WARMUP_COUNTDOWN ) {
CP( "cpm \"Countdown started.... ^3notready^7 ignored!\n\"" );
return;
}
if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
CP( "cpm \"You must be in the game to be ^3ready^7!\n\"" );
return;
}
// Can't ready until enough players.
if ( level.numPlayingClients < match_minplayers.integer ) {
CP( "cpm \"Not enough players to start match!\n\"" );
return;
}
if ( !G_cmdDebounce( ent, aCommandInfo[dwCommand].pszCommandName ) ) {
return;
}
// Move them to correct ready state
if ( ent->client->pers.ready == state ) {
CP( va( "print \"You are already%s ready!\n\"", status[state] ) );
} else {
ent->client->pers.ready = state;
if ( !level.intermissiontime ) {
if ( state ) {
G_MakeReady( ent );
} else {
G_MakeUnready( ent );
}
AP( va( "print \"%s^7 is%s ready!\n\"", ent->client->pers.netname, status[state] ) );
AP( va( "cp \"\n%s\n^3is%s ready!\n\"", ent->client->pers.netname, status[state] ) );
}
}
G_readyMatchState();
}
示例7: A0
//.......................................................
// New speed up method to Cache time integrals
void Bs2JpsiPhi_SignalAlt_MO_v4::CacheAmplitudesAndAngles() {
CachedA1 = A0()*A0() * angleFactorA0A0( ) ;
CachedA2 = AP()*AP() * angleFactorAPAP( ) ;
CachedA3 = AT()*AT() * angleFactorATAT( ) ;
CachedA4 = AP()*AT() * angleFactorImAPAT( ) ;
CachedA5 = A0()*AP() * angleFactorReA0AP( ) ;
CachedA6 = A0()*AT() * angleFactorImA0AT( ) ;
CachedA7 = AS()*AS() * angleFactorASAS( ) ;
CachedA8 = AS()*AP() * angleFactorReASAP( ) ;
CachedA9 = AS()*AT() * angleFactorImASAT( ) ;
CachedA10= AS()*A0() * angleFactorReASA0( ) ;
}
示例8: attachProcess
SNRESULT
attachProcess(int target, uint unitId, uint processId)
{
HINSTANCE hLib = LoadLibrary("PS3TMAPI_NET.DLL");
__cAttachProcess AP = (__cAttachProcess)GetProcAddress(hLib, "SNPS3ProcessAttach");
return (AP(target, unitId, processId));
}
示例9: G_UnMute_v
// *** Player Un-Mute ***
int G_UnMute_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
if (fRefereeCmd)
{
// handled elsewhere
return G_NOTFOUND;
}
// Vote request (vote is being initiated)
if (arg)
{
int pid;
if (!vote_allow_muting.integer && ent && !ent->client->sess.referee)
{
G_voteDisableMessage(ent, arg);
return G_INVALID;
}
else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
{
return G_INVALID;
}
else if ((pid = ClientNumberFromString(ent, arg2)) == -1)
{
return G_INVALID;
}
if (!level.clients[pid].sess.muted)
{
G_refPrintf(ent, "Player is not muted!");
return G_INVALID;
}
Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid);
Com_sprintf(arg2, VOTE_MAXSTRING, "%s", level.clients[pid].pers.netname);
// Vote action (vote has passed)
}
else
{
int pid = atoi(level.voteInfo.vote_value);
// Mute a player
if (level.clients[pid].sess.referee != RL_RCON)
{
trap_SendServerCommand(pid, va("cpm \"^3You have been un-muted\""));
level.clients[pid].sess.muted = qfalse;
AP(va("cp \"%s\n^3has been un-muted!\n\"", level.clients[pid].pers.netname));
ClientUserinfoChanged(pid);
}
else
{
G_Printf("Cannot un-mute a referee.\n");
}
}
return G_OK;
}
示例10: gamma
double Bs2JpsiPhi_mistagObservable_alt::Normalisation(DataPoint * measurement, PhaseSpaceBoundary * boundary)
{
// Get observables into member variables
t = measurement->GetObservable( timeName )->GetValue() - timeOffset;
ctheta_tr = measurement->GetObservable( cosThetaName )->GetValue();
phi_tr = measurement->GetObservable( phiName )->GetValue();
ctheta_1 = measurement->GetObservable( cosPsiName )->GetValue();
tagFraction = measurement->GetObservable( mistagName )->GetValue();
//tagFraction= 0.5; //PELC
// Get time boundaries into member variables
IConstraint * timeBound = boundary->GetConstraint("time");
if ( timeBound->GetUnit() == "NameNotFoundError" ) {
cerr << "Bound on time not provided" << endl;
return 0;
}
else {
tlo = timeBound->GetMinimum();
thi = timeBound->GetMaximum();
}
// Recalculate cached values if Physics parameters have changed
// Must do this for each of the two resolutions.
//PELC
// I dont think you can cache any more as normalisation depends upon the mistag which now changes per event.
if( true /*! normalisationCacheValid*/ ) {
for( tag = -1; tag <= 1; tag ++ ) {
resolution = resolution1 ;
normalisationCacheValueRes1[tag+1] = this->diffXsecNorm1( );
resolution = resolution2 ;
normalisationCacheValueRes2[tag+1] = this->diffXsecNorm1( );
}
normalisationCacheValid = true ;
}
// Return normalisation value according to tag
tag = (int)measurement->GetObservable( tagName )->GetValue();
double returnValue = resolution1Fraction*normalisationCacheValueRes1[tag+1] + (1. - resolution1Fraction)*normalisationCacheValueRes2[tag+1] ;
if( (returnValue <= 0.) || isnan(returnValue) ) {
cout << " Bs2JpsiPhi_mistagObservable_alt::Normalisation() returns <=0 or nan " << endl ;
cout << " gamma " << gamma() ;
cout << " gl " << gamma_l() ;
cout << " gh " << gamma_h() ;
cout << " AT " << AT() ;
cout << " AP " << AP() ;
cout << " A0 " << A0() ;
exit(1) ;
}
return returnValue ;
}
示例11: G_pause_cmd
// ************** PAUSE / UNPAUSE
//
// Pause/unpause a match.
void G_pause_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fPause)
{
char *status[2] = { "^5UN", "^1" };
if(team_nocontrols.integer) { G_noTeamControls(ent); return; }
if((PAUSE_UNPAUSING >= level.match_pause && !fPause) || (PAUSE_NONE != level.match_pause && fPause)) {
CP(va("print \"The match is already %sPAUSED^7!\n\"", status[fPause]));
return;
}
// Alias for referees
if(ent->client->sess.referee) G_refPause_cmd(ent, fPause);
else {
int tteam = G_teamID(ent);
if(!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName)) return;
// Trigger the auto-handling of pauses
if(fPause) {
if(0 == teamInfo[tteam].timeouts) {
CP("cpm \"^3Your team has no more timeouts remaining!\n\"");
return;
} else {
teamInfo[tteam].timeouts--;
level.match_pause = tteam + 128;
G_globalSound("sound/misc/referee.wav");
G_spawnPrintf(DP_PAUSEINFO, level.time + 15000, NULL);
AP(va("print \"^3Match is ^1PAUSED^3!\n^7[%s^7: - %d Timeouts Remaining]\n\"", aTeams[tteam], teamInfo[tteam].timeouts));
CP(va("cp \"^3Match is ^1PAUSED^3! (%s^3)\n\"", aTeams[tteam]));
level.server_settings |= CV_SVS_PAUSE;
trap_SetConfigstring(CS_SERVERTOGGLES, va("%d", level.server_settings));
}
} else if(tteam + 128 != level.match_pause) {
CP("cpm \"^3Your team didn't call the timeout!\n\"");
return;
} else {
AP("print \"\n^3Match is ^5UNPAUSED^3 ... resuming in 10 seconds!\n\n\"");
level.match_pause = PAUSE_UNPAUSING;
G_globalSound("sound/osp/prepare.wav");
G_spawnPrintf(DP_UNPAUSING, level.time + 10, NULL);
}
}
}
示例12: G_Kick_v
// *** Player Kick ***
int G_Kick_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
// Vote request (vote is being initiated)
if (arg)
{
int pid;
if (!vote_allow_kick.integer && ent && !ent->client->sess.referee)
{
G_voteDisableMessage(ent, arg);
return G_INVALID;
}
else if (G_voteDescription(ent, fRefereeCmd, dwVoteIndex))
{
return G_INVALID;
}
else if ((pid = ClientNumberFromString(ent, arg2)) == -1)
{
return G_INVALID;
}
if (level.clients[pid].sess.referee)
{
G_refPrintf(ent, "Can't vote to kick referees!");
return G_INVALID;
}
if (g_entities[pid].r.svFlags & SVF_BOT)
{
G_refPrintf(ent, "Can't vote to kick bots!");
return G_INVALID;
}
if (!fRefereeCmd && ent)
{
if (level.clients[pid].sess.sessionTeam != TEAM_SPECTATOR && level.clients[pid].sess.sessionTeam != ent->client->sess.sessionTeam)
{
G_refPrintf(ent, "Can't vote to kick players on opposing team!");
return G_INVALID;
}
}
Com_sprintf(level.voteInfo.vote_value, VOTE_MAXSTRING, "%d", pid);
Com_sprintf(arg2, VOTE_MAXSTRING, "%s", level.clients[pid].pers.netname);
// Vote action (vote has passed)
}
else
{
// Kick a player
trap_SendConsoleCommand(EXEC_APPEND, va("clientkick %d\n", atoi(level.voteInfo.vote_value)));
AP(va("cp \"%s\n^3has been kicked!\n\"", level.clients[atoi(level.voteInfo.vote_value)].pers.netname));
}
return G_OK;
}
示例13: G_lock_cmd
// ************** LOCK / UNLOCK
//
// Locks/unlocks a player's team.
void G_lock_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fLock)
{
int tteam;
if(team_nocontrols.integer) { G_noTeamControls(ent); return; }
if(!G_cmdDebounce(ent, aCommandInfo[dwCommand].pszCommandName)) return;
tteam = G_teamID(ent);
if(tteam == TEAM_AXIS || tteam == TEAM_ALLIES) {
if(teamInfo[tteam].team_lock == fLock) CP(va("print \"^3Your team is already %sed!\n\"", lock_status[fLock]));
else {
char *info = va("\"The %s team is now %sed!\n\"", aTeams[tteam], lock_status[fLock]);
teamInfo[tteam].team_lock = fLock;
AP(va("print %s", info));
AP(va("cp %s", info));
}
} else CP(va("print \"Spectators can't %s a team!\n\"", lock_status[fLock]));
}
示例14: G_Surrender_v
int G_Surrender_v( gentity_t *ent, unsigned int dwVoteIndex,
char *arg, char *arg2, qboolean fRefereeCmd )
{
team_t team;
// Vote request (vote is being initiated)
if(arg) {
if(g_gamestate.integer != GS_PLAYING) {
return G_INVALID;
}
if(!vote_allow_surrender.integer)
return G_INVALID;
// yada - noone ever seemes to have thought of refs calling this
if( !ent||
ent->client->sess.sessionTeam==TEAM_SPECTATOR
){
if(trap_Argc()==2){
G_refPrintf(ent,"Usage: \\%s surrender <team>",fRefereeCmd?"ref":"callvote");
return G_INVALID;
}
team=TeamFromString(arg2);
if( team!=TEAM_AXIS&&
team!=TEAM_ALLIES
){
G_refPrintf(ent,"Invalid team specified.");
return G_INVALID;
}
level.voteInfo.voteTeam=team;
}else{
team=ent->client->sess.sessionTeam;
}
Q_strncpyz(arg2,
(team == TEAM_AXIS) ?
"[AXIS]" : "[ALLIES]",
VOTE_MAXSTRING);
}
// Vote action (vote has passed)
else if(g_gamestate.integer == GS_PLAYING){
char cs[MAX_STRING_CHARS];
trap_GetConfigstring(CS_MULTI_MAPWINNER, cs, sizeof(cs));
Info_SetValueForKey(cs, "winner",
(level.voteInfo.voteTeam == TEAM_AXIS) ? "1" : "0");
trap_SetConfigstring(CS_MULTI_MAPWINNER, cs);
LogExit(va("%s Surrender\n",
(level.voteInfo.voteTeam == TEAM_AXIS) ?
"Axis" : "Allies"));
AP(va("chat \"%s have surrendered!\" -1",
(level.voteInfo.voteTeam == TEAM_AXIS) ?
"^1AXIS^7" : "^4ALLIES^7"));
}
return(G_OK);
}
示例15: G_Nextmap_v
// *** Nextmap ***
int G_Nextmap_v(gentity_t *ent, unsigned int dwVoteIndex, char *arg, char *arg2, qboolean fRefereeCmd)
{
// Vote request (vote is being initiated)
if(arg) {
if(trap_Argc() > 2) {
G_refPrintf(ent, "Usage: ^3%s %s%s\n", ((fRefereeCmd) ? "\\ref" : "\\callvote"), arg, aVoteInfo[dwVoteIndex].pszVoteHelp);
return(G_INVALID);
} else if(!vote_allow_nextmap.integer && ent && !ent->client->sess.referee) {
G_voteDisableMessage(ent, arg);
return(G_INVALID);
} else {
char s[MAX_STRING_CHARS];
if( g_gametype.integer == GT_WOLF_CAMPAIGN ) {
trap_Cvar_VariableStringBuffer( "nextcampaign", s, sizeof(s) );
if( !*s ) {
G_refPrintf(ent, "'nextcampaign' is not set." );
return(G_INVALID);
}
} else {
trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof(s) );
if( !*s ) {
G_refPrintf(ent, "'nextmap' is not set." );
return(G_INVALID);
}
}
}
// Vote action (vote has passed)
} else {
if( g_gametype.integer == GT_WOLF_CAMPAIGN ) {
// Load in the nextcampaign
trap_SendConsoleCommand(EXEC_APPEND, "vstr nextcampaign\n");
AP("cp \"^3*** Loading nextcampaign! ***\n\"");
} else {
// Load in the nextmap
trap_SendConsoleCommand(EXEC_APPEND, "vstr nextmap\n");
AP("cp \"^3*** Loading nextmap! ***\n\"");
}
}
return(G_OK);
}