void AseLoader::Process_MESH_FACE_LIST(IN std::vector<D3DXVECTOR3>& pos, OUT std::vector<FVF_PositionNormalTexture>& vertex) { int level = 0; do { char* aseToken = GetToken(); if (IsEqual(aseToken, "{")) { level++; } else if (IsEqual(aseToken, "}")) { level--; } else if (IsEqual(aseToken, ID_MESH_FACE)) { // //*MESH_FACE 0: A : 0 B : 1 C : 2 AB : 1 BC : 1 CA : 1 int index = GetInteger(); GetToken(); int a = GetInteger(); GetToken(); int b = GetInteger(); GetToken(); int c = GetInteger(); vertex[index * 3 + 0].pos = pos[a]; vertex[index * 3 + 1].pos = pos[c]; vertex[index * 3 + 2].pos = pos[b]; } } while (level > 0); }
bool CGlobalVars::info_single_limper() { /* * return true if there is a single limper * Example: * -true: I'm Bigblind, SB fold and other player limped * -true: I'm Bigblind, SB limped and the rest fold */ if (br==1) { if(SB) { //SB posted (2*bblind+1*sblind) if(IsEqual(get_potplayer(), (get_sblind() + get_bblind() + get_bblind()))) return true; if(set_preflop_position() == 2 && IsEqual(get_potplayer(), (get_bblind() + get_bblind()))) return true; } else { //no SB (2*bblind) if(IsEqual(get_potplayer(), get_bblind() + get_bblind())) return true; } } return false; }
bool IsEqual(const pvdb::ConceptMap& lhs, const pvdb::ConceptMap& rhs) { //Compare nodes { const std::vector<boost::shared_ptr<const pvdb::Node> > lhs_nodes = lhs.GetNodes(); const std::vector<boost::shared_ptr<const pvdb::Node> > rhs_nodes = rhs.GetNodes(); if (lhs_nodes.size() != rhs_nodes.size()) return false; const int n_nodes = static_cast<int>(lhs_nodes.size()); for (int i=0; i!=n_nodes; ++i) { if (!IsEqual(*lhs_nodes[i],*rhs_nodes[i])) return false; } } //Compare edges { const std::vector<boost::shared_ptr<const pvdb::Edge> > lhs_edges = lhs.GetEdges(); const std::vector<boost::shared_ptr<const pvdb::Edge> > rhs_edges = rhs.GetEdges(); if (lhs_edges.size() != rhs_edges.size()) return false; const int n_edges = static_cast<int>(lhs_edges.size()); for (int i=0; i!=n_edges; ++i) { if (!IsEqual(*lhs_edges[i],*rhs_edges[i])) return false; } } return true; }
CShape3D::Num CAABB::Dist2Line(const CVector<3, Num> &vMin, const CVector<3, Num> &vMax, const CVector<3, Num> &vPoint0, const CVector<3, Num> &vPoint1, Num nLineMin, Num nLineMax) { CVector<3, Num> vLine; int i, j; Num nDist, nFactor; vLine = vPoint1 - vPoint0; if (IsEqual(vLine.LengthSqr(), 0)) return Dist2Point(vMin, vMax, vPoint0); // Check for intersections with the sides for (i = 0; i < 3; i++) { if (IsEqual(vLine[i], 0)) { // Line is parallel to the AABB sides in this dimension if (vPoint0[i] >= vMin[i] && vPoint0[i] <= vMax[i]) // Coordinate is within bounds, continue checking the other dimensions continue; break; // Line can't intersect the AABB } if (TestLineCoordinate(vMin, vMax, vPoint0, vLine, nLineMin, nLineMax, vMin[i], i, nFactor)) // Line intersects the Min plane of the dimension inside the AABB side return 0; if (TestLineCoordinate(vMin, vMax, vPoint0, vLine, nLineMin, nLineMax, vMax[i], i, nFactor)) // Line intersects the Max plane of the dimension inside the AABB side return 0; } // No side intersections found, check AABB edges for the least distance to the line nDist = Util::F_INFINITY; for (i = 0; i < 3; i++) for (j = 0; j < 4; j++) { Num nEdgeDist = Edge2LineDist(vMin, vMax, i, j, vPoint0, vPoint1, nLineMin, nLineMax); if (nDist > nEdgeDist) nDist = nEdgeDist; } return nDist; }
void AseLoader::Process_MATERIAL_LIST() { int level = 0; do { char* aseToken = GetToken(); if (IsEqual(aseToken, "{")) { level++; } else if (IsEqual(aseToken, "}")) { level--; } else if (IsEqual(aseToken, ID_MATERIAL_COUNT)) { materialTextures.resize(GetInteger()); } else if (IsEqual(aseToken, ID_MATERIAL)) { int mtRef = GetInteger(); materialTextures[mtRef] = new MaterialTexture; Process_MATERIAL(materialTextures[mtRef]); } } while ( level > 0 ); }
void AseLoader::Process_MESH_VERTEX_LIST( OUT std::vector<D3DXVECTOR3>& pos ) { int level = 0; do { char* aseToken = GetToken(); if (IsEqual(aseToken, "{")) { level++; } else if (IsEqual(aseToken, "}")) { level--; } else if (IsEqual(aseToken, ID_MESH_VERTEX)) { // int index = GetInteger(); float x = GetFloat(); float z = GetFloat(); float y = GetFloat(); pos[index] = D3DXVECTOR3(x, y, z); } } while (level > 0); }
void PCFPipesMgr::CombinationPipe(AcGePoint3d &Pt1,AcGePoint3d &Pt2) { PCFPipe *pPipe = NULL; PCFPipe *pPipe1 = NULL; PCFPipe *pPipe2 = NULL; IteratorPtr<PCFPipe> PipeitPtr(CreateIt()); for(PipeitPtr->Fist();!PipeitPtr->IsDone();PipeitPtr->Next()) { pPipe = &PipeitPtr->CurrentItem(); ASSERT(pPipe != NULL); if(IsEqual(pPipe->EndPt(),Pt1)) { pPipe1 = pPipe; } if(IsEqual(pPipe->StartPt(),Pt2)) { pPipe2 = pPipe; } } if(pPipe1!=NULL&&pPipe2!=NULL) { pPipe1->EndPt(pPipe2->EndPt()); Del(pPipe2->GetKey()); } }
void cAseLoader::ProcessMESH_TFACELIST( IN std::vector<D3DXVECTOR2>& vecVT, OUT std::vector<ST_PNT_VERTEX>& vecVertex ) { int nLevel = 0; do { char* szToken = GetToken(); if(IsEqual(szToken, "{")) { ++nLevel; } else if(IsEqual(szToken, "}")) { --nLevel; } else if(IsEqual(szToken, ID_MESH_TFACE)) { int nFaceIndex = GetInteger(); int nA = GetInteger(); int nB = GetInteger(); int nC = GetInteger(); vecVertex[nFaceIndex * 3 + 0].t = vecVT[nA]; vecVertex[nFaceIndex * 3 + 1].t = vecVT[nC]; vecVertex[nFaceIndex * 3 + 2].t = vecVT[nB]; } } while (nLevel > 0); }
void cAseLoader::ProcessMATERIAL_LIST() { int nLevel = 0; do { char* szToken = GetToken(); if(IsEqual(szToken, "{")) { ++nLevel; } else if(IsEqual(szToken, "}")) { --nLevel; } else if(IsEqual(szToken, ID_MATERIAL_COUNT)) { m_vecMtlTex.resize(GetInteger()); } else if(IsEqual(szToken, ID_MATERIAL)) { int nMtlIndex = GetInteger(); m_vecMtlTex[nMtlIndex] = new cMtlTex; ProcessMATERIAL(m_vecMtlTex[nMtlIndex]); } } while (nLevel > 0); }
void AseLoader::Process_POS_TRACK(OUT AseFrame* frame) { std::vector<PositionSample>& posTrack = frame->GetPosTrack(); int level = 0; do { char* aseToken = GetToken(); if (IsEqual(aseToken, "{")) { level++; } else if (IsEqual(aseToken, "}")) { level--; } else if (IsEqual(aseToken, ID_POS_SAMPLE)) { // PositionSample ps; ps.frame = GetInteger(); ps.pos.x = GetFloat(); ps.pos.y = GetFloat(); ps.pos.z = GetFloat(); posTrack.push_back(ps); } } while (level > 0); }
BOOL IsEqual(CERTIFICATENAMES& n1, CERTIFICATENAMES&n2) { if (n1.flags != n2.flags) return FALSE; if (n1.flags & CERTIFICATENAME_DIGEST) { if (memcmp(&n1.digest, &n2.digest, sizeof(n1.digest)) != 0) return FALSE; } if (n1.flags & CERTIFICATENAME_ISSUERSERIAL) { if (!IsEqual(n1.issuerSerial.issuerName, n2.issuerSerial.issuerName)) return FALSE; if (!IsEqual(n1.issuerSerial.serialNumber, n2.issuerSerial.serialNumber)) return FALSE; } if (n1.flags & CERTIFICATENAME_SUBJECT) { if (!IsEqual(n1.subject, n2.subject)) return FALSE; } if (n1.flags & CERTIFICATENAME_ISSUER) { if (!IsEqual(n1.issuer, n2.issuer)) return FALSE; } return TRUE; }
double CTableLimits::GuessSmallBlindFromBigBlind() { write_log(3, "CTableLimits::GuessSmallBlindFromBigBlind()\n"); // Special case: 0.02/0.05/0.10 if (IsEqual(tablelimit_unreliable_input.bblind, 0.05)) { return 0.02; } // Special case: 0.05/0.15/0.30 if (IsEqual(tablelimit_unreliable_input.bblind, 0.15)) { return 0.05; } // Special case: 0.10/0.25/0.50 if (IsEqual(tablelimit_unreliable_input.bblind, 0.25)) { return 0.10; } // Special case: 0.02/0.05 if (IsEqual(tablelimit_unreliable_input.bblind, 0.05)) { return 0.02; } return (tablelimit_unreliable_input.bblind / 2); }
list search_and_destroy(element e, list l) { list r = l; if (l == NULL) return NULL; if (detect(e, l) == false) return l; list tmp = l; if (IsEqual(head(l), e) == true) { l = DelFirst(l); return l; } while (llenght(l) != 1) { if (IsEqual(head(tail(l)), e) == true) { DeleteElement(l->next->value); tmp = l->next; l->next = l->next->next; free(tmp); return r; } l = tail(l); } return NULL; }
void Room::reorderWalls() { int index; std::vector<MazeWall>::iterator it; MazeWall tempMaze; double tmpX = walls[0].To_X; double tmpY = walls[0].To_Y; for(unsigned int i = 0; i < walls.size();i++) { index = getWallIndex(i + 1, tmpX ,tmpY); if(IsEqual(tmpX, walls[index].To_X) && IsEqual(tmpY,walls[index].To_Y)) { tmpX = walls[index].From_X; tmpY = walls[index].From_Y; } else { tmpX = walls[index].To_X; tmpY = walls[index].To_Y; } it = walls.begin(); if(index > -1) { tempMaze = walls[index]; walls.erase(it + index); walls.insert(it + i + 1,tempMaze); } } }
int CGlobalVars::first_limper() { /* * */ //Check UTG...BT for(int i=3; i < k_MaxChairs; i++) { for(int j=0; j < k_MaxChairs; j++) { if(IsEqual(currentbets[j], get_bblind()) && (get_ac_dealpos(j) == i)) return j; } } //Check SB for(int i=0; i < k_MaxChairs; i++) { if(IsEqual(currentbets[i], get_bblind()) && (get_ac_dealpos(i) == 1)) return i; } return -1; }
void AseLoader::Process_ID_MESH_TFACELIST(IN std::vector<D3DXVECTOR2>& uv, OUT std::vector<FVF_PositionNormalTexture>& vertex) { int level = 0; do { char* aseToken = GetToken(); if (IsEqual(aseToken, "{")) { level++; } else if (IsEqual(aseToken, "}")) { level--; } else if (IsEqual(aseToken, ID_MESH_TFACE)) { // int index = GetInteger(); int a = GetInteger(); int b = GetInteger(); int c = GetInteger(); vertex[index * 3 + 0].tex = uv[a]; vertex[index * 3 + 1].tex = uv[c]; vertex[index * 3 + 2].tex = uv[b]; } } while (level > 0); }
cFrame* cAseLoader::Load( char* szFullPath ) { fopen_s(&m_fp, szFullPath, "r"); while(char* szToken = GetToken()) { if(IsEqual(szToken, ID_SCENE)) { SkipBlock(); } else if(IsEqual(szToken, ID_MATERIAL_LIST)) { ProcessMATERIAL_LIST(); } else if(IsEqual(szToken, ID_GEOMETRY)) { cFrame* pFrame = ProcessGEOMOBJECT(); m_mapFrame[pFrame->GetFrameName()] = pFrame; if(m_pRoot == NULL) m_pRoot = pFrame; } } fclose(m_fp); if(m_pRoot) m_pRoot->SetOriginLocalTM(NULL); return m_pRoot; }
void AseLoader::Process_TM_ANIMATION(OUT AseFrame* frame) { int level = 0; do { char* aseToken = GetToken(); if (IsEqual(aseToken, "{")) { level++; } else if (IsEqual(aseToken, "}")) { level--; } else if (IsEqual(aseToken, ID_POS_TRACK)) { Process_POS_TRACK(frame); } else if (IsEqual(aseToken, ID_ROT_TRACK)) { Process_ROT_TRACK(frame); } } while (level > 0); }
void cAseLoader::ProcessMESH_VERTEX_LIST( OUT std::vector<D3DXVECTOR3>& vecV ) { int nLevel = 0; do { char* szToken = GetToken(); if(IsEqual(szToken, "{")) { ++nLevel; } else if(IsEqual(szToken, "}")) { --nLevel; } else if(IsEqual(szToken, ID_MESH_VERTEX)) { int nIndex = GetInteger(); vecV[nIndex].x = GetFloat(); vecV[nIndex].z = GetFloat(); vecV[nIndex].y = GetFloat(); } } while (nLevel > 0); }
bool CMesh::IntersectSegments(CVector<2> const &vA0, CVector<2> const &vA1, CVector<2> const &vB0, CVector<2> const &vB1, float &fTA, float &fTB) { CVector<2> vA, vB, vBP, vAP, vD; float fD; vA = vA1 - vA0; vB = vB1 - vB0; vAP = vA.Perpendicular2D(); vBP = vB.Perpendicular2D(); fD = vA % vBP; if (IsEqual(fD, 0)) // Colinear or one of the vectors is 0, so we return no intersection return false; vD = vB0 - vA0; fTA = (vD % vBP) / fD; if (fTA < 0 || fTA > 1) return false; fTB = (vD % vAP) / fD; if (fTB < 0 || fTB > 1) return false; ASSERT(IsEqual(((vB0 + fTB * vB) - (vA0 + fTA * vA)).Length(), 0)); return true; }
void AseLoader::Process_MESH_TVERTLIST(OUT std::vector<D3DXVECTOR2>& uv) { int level = 0; do { char* aseToken = GetToken(); if (IsEqual(aseToken, "{")) { level++; } else if (IsEqual(aseToken, "}")) { level--; } else if (IsEqual(aseToken, ID_MESH_TVERT)) { // int index = GetInteger(); float u = GetFloat(); float v = GetFloat(); uv[index] = D3DXVECTOR2(u, 1 - v); } } while (level > 0); }
void CSphere::Transform(CVector<3, Num> const &vCenter, Num nRadius, CXForm const &kXForm, CVector<3, Num> &vXCenter, Num &nXRadius) { CVector<3, Num> vScale; vScale = kXForm.GetScale(); ASSERT(IsEqual(vScale.x(), vScale.y()) && IsEqual(vScale.y(), vScale.z())); vXCenter = kXForm.TransformPoint(vCenter); nXRadius = nRadius * vScale.x(); }
ERMsg COGRBaseOption::ProcessOption(int& i, int argc, char* argv[]) { ERMsg msg; string error; if (IsUsed(BASE_OPTIONS) && IsEqual(argv[i], "--utility_version")) { m_bVersion = true; } else if (IsUsed(BASE_OPTIONS) && IsEqual(argv[i], "-co") && i < argc - 1) { m_createOptions.push_back(argv[++i]); } else if (IsUsed(BASE_OPTIONS) && IsEqual(argv[i], "-of") && i < argc - 1) { m_format = argv[++i]; } else if (IsUsed(BASE_OPTIONS) && IsEqual(argv[i], "-wo") && i < argc - 1)//working option { //UNIFIED_SRC_NODATA m_workOptions.push_back(argv[++i]); } else if (IsUsed(BASE_OPTIONS) && IsEqual(argv[i], "-multi")) { m_bMulti = true; } else if (IsUsed(BASE_OPTIONS) && IsEqual(argv[i], "-f") && i < argc - 1) { m_format = argv[i + 1]; } else if (IsUsed(BASE_OPTIONS) && IsEqual(argv[i], "-overwrite")) { m_bOverwrite = true; } else if (IsUsed(BASE_OPTIONS) && IsEqual(argv[i], "-q")) { m_bQuiet = true; } else if (IsEqual(argv[i], "-?") || IsEqual(argv[i], "-help")) { m_bNeedHelp = true; } else if (argv[i][0] == '-') { error = string("ERROR: Invalid option: ") + argv[i] + ", use - ? for more help.\n"; msg.ajoute(error); //return false; } else { m_filesPath.push_back(argv[i]); } return msg; }
int Room::getWallIndex(int startIndex, double X,double Y) { for(unsigned int i = startIndex; i < walls.size(); i++) { if((IsEqual(X, walls[i].From_X) && IsEqual(Y,walls[i].From_Y)) || (IsEqual(X, walls[i].To_X) && IsEqual(Y,walls[i].To_Y))) return i; } return -1; }
void PlayerHpBar::SetOffset(const std::string &target, Vector2f offset) { if (IsEqual(target.c_str(), "avatar")) { m_avatarOffset = offset; } else if (IsEqual(target.c_str(), "bar")) { m_barOffset = offset; } }
int TranslateSeriesStatusFrom(const std::wstring& value) { if (IsEqual(value, L"Currently Airing")) { return anime::kAiring; } else if (IsEqual(value, L"Finished Airing")) { return anime::kFinishedAiring; } else if (IsEqual(value, L"Not Yet Aired")) { return anime::kNotYetAired; } LOG(LevelWarning, L"Unknown value: " + value); return anime::kUnknownStatus; }
LRESULT AnimeDialog::OnNotify(int idCtrl, LPNMHDR pnmh) { switch (idCtrl) { case IDC_LINK_NOWPLAYING: { switch (pnmh->code) { // Link click case NM_CLICK: { PNMLINK pNMLink = reinterpret_cast<PNMLINK>(pnmh); wstring action = pNMLink->item.szUrl; if (IsEqual(pNMLink->item.szID, L"menu")) { action = UI.Menus.Show(m_hWindow, 0, 0, pNMLink->item.szUrl); } else if (IsEqual(pNMLink->item.szID, L"search")) { action = L"SearchAnime(" + CurrentEpisode.title + L")"; } else if (IsEqual(pNMLink->item.szUrl, L"score")) { action = L""; CurrentEpisode.anime_id = ToInt(pNMLink->item.szID); auto anime_item = AnimeDatabase.FindItem(CurrentEpisode.anime_id); if (anime_item) { anime_item->AddtoUserList(); auto synonyms = anime_item->GetUserSynonyms(); synonyms.push_back(CurrentEpisode.title); anime_item->SetUserSynonyms(synonyms); Meow.UpdateCleanTitles(anime_item->GetId()); Settings.Save(); anime_item->StartWatching(CurrentEpisode); MainDialog.ChangeStatus(); } } ExecuteAction(action, 0, GetCurrentId()); return TRUE; } // Custom draw case NM_CUSTOMDRAW: { return CDRF_DODEFAULT; } } break; } case IDC_TAB_ANIME: { switch (pnmh->code) { // Tab select case TCN_SELCHANGE: { SetCurrentPage(tab_.GetCurrentlySelected() + 1); break; } } break; } } return 0; }
ERMsg COGRBaseOption::ParseOption(int argc, char* argv[]) { ERMsg msg; // Must process GDAL_SKIP before GDALAllRegister(), but we can't call // GDALGeneralCmdLineProcessor before it needs the drivers to be registered // for the --format or --formats options for (int i = 1; i < argc; i++) { if (IsEqual(argv[i], "--config") && i + 2 < argc && IsEqual(argv[i + 1], "GDAL_SKIP")) { CPLSetConfigOption(argv[i + 1], argv[i + 2]); i += 2; } } // -------------------------------------------------------------------- // Register standard GDAL drivers, and process generic GDAL // command options. // -------------------------------------------------------------------- OGRRegisterAll(); argc = OGRGeneralCmdLineProcessor(argc, &argv, 0); if (argc < 1) exit(-argc); // -------------------------------------------------------------------- // Parse arguments. // -------------------------------------------------------------------- for (int i = 1; i < argc; i++) { msg += ProcessOption(i, argc, argv); } if (m_bVersion) { string error = Format("%s was compiled against GDAL %s and is running against GDAL %s\n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); msg.ajoute(error); //return msg; } if (m_bNeedHelp) { msg.ajoute(GetUsage()); msg.ajoute(GetHelp()); //return msg; } return msg; }
/** * Virtual function to calculate a point for this fucntion. * @param x (input) x input value for this function. * @return Y value corresponding to the x input. */ TMathResult TrigFunction::CalculateY( double x, double *y) { TMathResult status = MATH_SUCCESS; double result = 0; double angle = x; if(GetAngleMode() == MATH_ANGLES_IN_DEGREES) { angle = DegreesToRadians(x); } switch(GetOperatorType()) { case MATH_SIN: result = sin(angle); break; case MATH_COS: result = cos(angle); break; case MATH_TAN: result = tan(angle); break; case MATH_COT: result = tan(angle); if(!IsEqual(result, 0)) result = 1/result; else status = MATH_UNDEFINED; break; case MATH_SEC: result = cos(angle); if(!IsEqual(result, 0)) result = 1/result; else status = MATH_UNDEFINED; break; case MATH_CSC: result = sin(angle); if(!IsEqual(result, 0)) result = 1/result; else status = MATH_UNDEFINED; break; } if(status == MATH_SUCCESS) *y = result; return status; }
uint ButtonComponent::GetStyleIndex(const std::string& style) { if (IsEqual(style.c_str(), "deep_on_click")) { return DEEP_ON_CLICK; } else if (IsEqual(style.c_str(), "deep_on_focus")) { return DEEP_ON_FOCUS; } assert(nullptr); return 100; }