本文整理汇总了C++中Phase函数的典型用法代码示例。如果您正苦于以下问题:C++ Phase函数的具体用法?C++ Phase怎么用?C++ Phase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Phase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Phase
bool game_cl_ArtefactHunt::NeedToSendReady_Spectator(int key, game_PlayerState* ps)
{
CStringTable st;
bool res = ( GAME_PHASE_PENDING == Phase() && kWPN_FIRE == key) ||
( (kJUMP == key) && GAME_PHASE_INPROGRESS==Phase() &&
CanBeReady());
if ((Phase() == GAME_PHASE_INPROGRESS) &&
(kJUMP==key) &&
m_cl_dwWarmUp_Time)
{
return res;
}
if ((GAME_PHASE_INPROGRESS==Phase()) && (kJUMP==key) &&
(iReinforcementTime!=0) &&
(!m_game_ui->m_pBuySpawnMsgBox->IsShown()) &&
local_player && (local_player->money_for_round+m_iSpawn_Cost)>=0)
{
string1024 BuySpawnText;
xr_sprintf (BuySpawnText, *st.translate("mp_press_yes2pay"),
abs(local_player->money_for_round), abs(m_iSpawn_Cost));
m_game_ui->m_pBuySpawnMsgBox->SetText(BuySpawnText);
if (m_bTeamSelected && m_bSkinSelected)
m_game_ui->m_pBuySpawnMsgBox->ShowDialog(true);
return false;
};
return res;
}
示例2: ADDallSpriteFloor
/************** merge PWAD IWAD directory module ****************/
void ADDallSpriteFloor(const char *wadout, const char *doomwad, const char
*wadres,NTRYB select)
{
struct WADINFO iwad;
struct WADINFO pwad;
struct WADINFO rwad;
Int16 n;
ENTRY *iiden; /*identify entry in IWAD*/
ENTRY *piden; /*identify entry in PWAD*/
Int32 start,size,ostart,osize;
Int16 pnm;char *Pnam;Int32 Pnamsz;
struct WADDIR *NewDir;Int32 NewNtry;
Phase("ME88", "Copying sprites and/or flats");
Phase("ME88", " from iwad %s", fname (doomwad));
Phase("ME88", " and pwad %s", fname (wadres));
Phase("ME88", " into pwad %s", fname (wadout));
/* get iwad directory, and identify */
iwad.ok=0;
WADRopenR(&iwad,doomwad);
/*find PNAMES*/
pnm=WADRfindEntry(&iwad,"PNAMES");
if(pnm<0) ProgError("ME91", "Can't find PNAMES in main WAD");
Pnam=WADRreadEntry(&iwad,pnm,&Pnamsz);
/* identify iwad*/
iiden=IDENTentriesIWAD(&iwad, Pnam, Pnamsz,TRUE);
/* get pwad directory, and identify*/
pwad.ok=0;
WADRopenR(&pwad,wadres);
piden=IDENTentriesPWAD(&pwad, Pnam, Pnamsz);
/**/
Free(Pnam);
/*where to put pwad? at pwadstart*/
if((iwad.maxpos|pwad.maxpos)&EXTERNAL )Bug("ME94", "AddExt");
/* merge the two directories */
NewDir=LISmergeDir(&NewNtry,TRUE,TRUE,select,&iwad,iiden,EXTERNAL,&pwad,piden,0);
/* create a new PWAD*/
rwad.ok=0;
WADRopenW(&rwad,wadout,PWAD, 1);
for(n=0;n<NewNtry;n++)
{ ostart=NewDir[n].start;
osize=NewDir[n].size;
WADRalign4(&rwad);
start=WADRposition(&rwad);
if(ostart&EXTERNAL)
size=WADRwriteWADbytes(&rwad,&iwad,ostart&(~EXTERNAL),osize);
else
size=WADRwriteWADbytes(&rwad,&pwad,ostart,osize);
WADRdirAddEntry(&rwad,start,size,NewDir[n].name);
}
Free(NewDir);
/*close files memory*/
WADRclose(&iwad);
WADRclose(&pwad);
WADRwriteDir(&rwad, 1);
WADRclose(&rwad);
Phase("ME98", "Addition of sprites and floors is complete");
}
示例3: test_eval
/*verifica che la valutazione del bianco e del nero sia simmetrica*/
void test_eval() {
/* Materiale:equal
KS:equal OK
PS:black (White isolated and hang)*/
char p[] = "2rq1rk1/pb2bppp/1pn1p3/2p5/3P4/P1PBPN2/1B2QPPP/3R1RK1 w - - 0 1";
/*char fp[]="3r1rk1/1b2qppp/p1pbpn2/3p4/2P5/1PN1P3/PB2BPPP/2RQ1RK1 w - - 0 1";*/
/*char p[] = "8/PPP4k/8/8/8/8/4Kppp/8 w - - ";*/
/* Materiale:black (bishop pair)
KS:equal
PS:black (white weak white squares)*/
/*char p[]="rnbqkb1r/pppp1ppp/8/4P3/3P4/3Q4/PP3PPP/RNB1K1NR b KQkq - 0 1";*/
/* Materiale:black (bishop pair)
KS:equal
PS:black (white weak white squares isol back)*/
/*char p[]="r2qkb1r/1p1b3p/p3ppp1/2p5/2P5/4P2Q/PB1P1PPP/RN3RK1 b k - 0 1";*/
/* Materiale:equal
KS:equal
PS:equal*/
/*char p[]="r2q1rk1/pb1nbppp/1p2pn2/8/1P6/P4NP1/1B1NPPBP/R2Q1RK1 w - - 0 0";*/
/* Materiale:
KS:black
PS:black--->sbagliato*/
/*char p[]="2br1rk1/pp2bppp/3p2n1/3P4/4P1n1/1B3NN1/PP1B2PP/R3R1K1 w - - 0 0";*/
/* Materiale:
KS:white
PS:*/
/*char p[]="R1n5/5rkp/3p2p1/2rNpq2/1NP4b/7P/4QPP1/5RK1 b - - 0 1";*/
int score;
set_position(p);
init_data();
print_board();
print_bitboard();
/*Precalcoliamo*/
Phase(WHITE) = eval_phase(WHITE);
Phase(BLACK) = eval_phase(BLACK);
score = eval(0);
printf("eval %d\n", score);
/*set_position(fp);
init_data();
print_board();
print_bitboard();
Phase(WHITE)=eval_phase(WHITE);
Phase(BLACK)=eval_phase(BLACK);
score=eval(0);
printf("eval %d",score);*/
}
示例4: Warning
TDSPVector* TDSPBlockOperation::Sum2PhaseDiff(Int_t bl,
TDSPVector *in1,
TDSPVector *in2,
TDSPVector *result,
TComplex scaler) {
Int_t len1 = in1->GetLen();
TComplex *iv1 = in1->GetVec();
Int_t len2 = in1->GetLen();
TComplex *iv2 = in2->GetVec();
if (len1!=len2) {
Warning("Sum2PhaseDiff","input length differ (%d<>%d)",len1,len2);
}
if (len1%bl) {
Warning("Sum2PhaseDiff","length of input vector1 (%d) is not a multiple of the block len (%d)!",len1,bl);
}
if (len2%bl) {
Warning("Sum2PhaseDiff","length of input vector2 (%d) is not a multiple of the block len (%d)!",len2,bl);
}
Int_t len=TMath::Min(len1,len2);
if (!result) result = new TDSPVector();
result->SetLen(bl);
TComplex *ov = result->GetVec();
result->Zeros();
Double_t tmp;
if (scaler==1.) {
for(register Int_t i=0;i<len;++i) {
tmp = Phase(iv1[i]%iv2[i]);
ov[i%bl] += tmp*tmp;
}
} else {
for(register Int_t i=0;i<len;++i) {
tmp = Phase(iv1[i]%(scaler*iv2[i]));
ov[i%bl] += tmp*tmp;
}
}
return result;
}
示例5:
void CGameGraphBuilder::build_graph (
#ifdef PRIQUEL
LPCSTR graph_name,
LPCSTR cross_table_name,
#endif // PRIQUEL
LPCSTR level_name
)
{
Phase ("Building level game graph");
Msg ("level \"%s\"",level_name);
#ifdef PRIQUEL
m_graph_name = graph_name;
m_cross_table_name = cross_table_name;
#endif // PRIQUEL
m_level_name = level_name;
// CTimer timer;
// timer.Start ();
create_graph (0.000000f,0.000047f);
// Msg ("%f",timer.GetElapsed_sec());
load_level_graph (0.000047f,0.002470f);
// Msg ("%f",timer.GetElapsed_sec());
load_graph_points (0.002517f,0.111812f);
// Msg ("%f",timer.GetElapsed_sec());
build_cross_table (0.114329f,0.773423f);
// Msg ("%f",timer.GetElapsed_sec());
build_graph (0.887752f,0.112248f);
// Msg ("%f",timer.GetElapsed_sec());
Msg ("Level graph is generated successfully");
}
示例6:
BOOL game_cl_ArtefactHunt::CanCallBuyMenu ()
{
if (!m_bBuyEnabled) return FALSE;
if (Phase()!=GAME_PHASE_INPROGRESS) return false;
if (!is_buy_menu_ready())
return FALSE;
if (m_game_ui->m_pUITeamSelectWnd && m_game_ui->m_pUITeamSelectWnd->IsShown())
{
return FALSE;
};
if (pCurSkinMenu && pCurSkinMenu->IsShown())
{
return FALSE;
};
if ( m_game_ui && m_game_ui->GetActorMenu().IsShown() )
{
return FALSE;
}
/*if (m_game_ui->m_pInventoryMenu && m_game_ui->m_pInventoryMenu->IsShown())
{
return FALSE;
};*/
CActor* pCurActor = smart_cast<CActor*> (Level().CurrentEntity());
if (!pCurActor || !pCurActor->g_Alive()) return FALSE;
return TRUE;
};
示例7:
BOOL game_cl_Deathmatch::CanCallBuyMenu ()
{
if (Phase()!=GAME_PHASE_INPROGRESS) return false;
if (!is_buy_menu_ready())
return FALSE;
if (Level().CurrentEntity() && !smart_cast<CSpectator*>(Level().CurrentEntity()))
{
return FALSE;
};
if (!m_bSkinSelected || m_bSpectatorSelected) return FALSE;
if (pCurSkinMenu && pCurSkinMenu->IsShown())
{
return FALSE;
};
if ( m_game_ui && m_game_ui->ActorMenu().IsShown() )
{
return FALSE;
}
/*if (m_game_ui->m_pInventoryMenu && m_game_ui->m_pInventoryMenu->IsShown())
{
return FALSE;
};*/
return m_bBuyEnabled;
};
示例8: Phase
Phase BodyStateEquation::operator()(const Phase &y) const {
glm::vec3 force = m_body.netForce();
for (auto&& c : m_body.m_constraints) {
force += c.force(y.position, c.attachedTo().position());
}
return Phase(y.momentum / m_body.mass(), force);
}
示例9: operator
void game_sv_GameState::Update ()
{
struct ping_filler
{
void operator()(IClient* client)
{
xrClientData* C = static_cast<xrClientData*>(client);
if (!C->ps)
return;
C->ps->ping = u16(C->stats.getPing());
}
};
ping_filler tmp_functor;
m_server->ForEachClientDo(tmp_functor);
if (!IsGameTypeSingle() && (Phase() == GAME_PHASE_INPROGRESS))
{
m_item_respawner.update(Level().timeServer());
}
if (!g_dedicated_server)
{
if (Level().game) {
CScriptProcess *script_process = ai().script_engine().script_process(ScriptEngine::eScriptProcessorGame);
if (script_process)
script_process->update ();
}
}
}
示例10: MovementInform
void MovementInform(uint32 type, uint32 id) override
{
if (type != POINT_MOTION_TYPE)
return;
uint8 nextBossId = 0;
switch (id)
{
case PHASE_FRENZIED_WORGEN:
nextBossId = DATA_FRENZIED_WORGEN;
break;
case PHASE_RAVENOUS_FURLBORG:
nextBossId = DATA_RAVENOUS_FURBOLG;
break;
case PHASE_MASSIVE_JORMUNGAR:
nextBossId = DATA_MASSIVE_JORMUNGAR;
break;
case PHASE_FEROCIOUS_RHINO:
nextBossId = DATA_FEROCIOUS_RHINO;
break;
case PHASE_GORTOK_PALEHOOF:
nextBossId = DATA_GORTOK_PALEHOOF;
break;
default:
return;
}
if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetGuidData(nextBossId)))
DoCast(nextBoss, SPELL_ORB_CHANNEL, false);
currentPhase = Phase(id);
SummonTimer = 5000;
}
示例11: Reset
void Reset() override
{
_Reset();
/// There is a good reason to store them like this, we are going to shuffle the order.
for (uint32 i = PHASE_FRENZIED_WORGEN; i < PHASE_GORTOK_PALEHOOF; ++i)
Sequence[i] = Phase(i);
/// This ensures a random order and only executes each phase once.
std::random_shuffle(Sequence, Sequence + PHASE_GORTOK_PALEHOOF);
uiArcingSmashTimer = 15000;
uiImpaleTimer = 12000;
uiWhiteringRoarTimer = 10000;
me->GetMotionMaster()->MoveTargetedHome();
AddCount = 0;
currentPhase = PHASE_NONE;
for (uint8 i = DATA_FRENZIED_WORGEN; i <= DATA_FEROCIOUS_RHINO; ++i)
if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(i)))
if (!temp->IsAlive())
temp->Respawn();
if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE)))
{
go->SetGoState(GO_STATE_READY);
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
}
示例12: switch
void game_cl_Deathmatch::net_import_state (NET_Packet& P)
{
inherited::net_import_state (P);
m_s32FragLimit = P.r_s32();
m_s32TimeLimit = P.r_s32() * 60000;
m_u32ForceRespawn = P.r_u32() * 1000;
m_cl_dwWarmUp_Time = P.r_u32();
m_bDamageBlockIndicators = !!P.r_u8();
// Teams
u16 t_count;
P.r_u16 (t_count);
teams.clear ();
for (u16 t_it=0; t_it<t_count; ++t_it)
{
game_TeamState ts;
P.r (&ts,sizeof(game_TeamState));
teams.push_back (ts);
};
switch (Phase())
{
case GAME_PHASE_PLAYER_SCORES:
{
P.r_stringZ(WinnerName);
bool NeedSndMessage = (xr_strlen(WinnerName) != 0);
if (NeedSndMessage && local_player && !xr_strcmp(WinnerName, local_player->getName()))
{
PlaySndMessage(ID_YOU_WON);
}
}break;
}
}
示例13: Medium
Medium(std::vector<std::size_t> const& phases_)
: property(MPL::number_of_properties)
{
for (auto p : phases_)
{
phases.push_back(Phase(p));
}
}
示例14: ImplicitLighting
void CBuild::Light()
{
//****************************************** Implicit
{
FPU::m64r ();
Phase ("LIGHT: Implicit...");
mem_Compact ();
ImplicitLighting();
}
//****************************************** Lmaps
{
FPU::m64r ();
Phase ("LIGHT: LMaps...");
mem_Compact ();
// Randomize deflectors
std::random_shuffle (g_deflectors.begin(),g_deflectors.end());
for (u32 dit = 0; dit<g_deflectors.size(); dit++) task_pool.push_back(dit);
// Main process (4 threads)
Status ("Lighting...");
CThreadManager threads;
const u32 thNUM = 6;
CTimer start_time; start_time.Start();
for (int L=0; L<thNUM; L++) threads.start(xr_new<CLMThread> (L));
threads.wait (500);
clMsg ("%f seconds",start_time.GetElapsed_sec());
}
//****************************************** Vertex
FPU::m64r ();
Phase ("LIGHT: Vertex...");
mem_Compact ();
LightVertex ();
//****************************************** Merge LMAPS
{
FPU::m64r ();
Phase ("LIGHT: Merging lightmaps...");
mem_Compact ();
xrPhase_MergeLM ();
}
}
示例15: game_phase
Phase game_phase(const Position& pos) {
Value npm = pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK);
return npm >= MidgameLimit ? PHASE_MIDGAME
: npm <= EndgameLimit ? PHASE_ENDGAME
: Phase(((npm - EndgameLimit) * 128) / (MidgameLimit - EndgameLimit));
}