// сделать 1 шаг обхода в ширину uint32_t ContinueWave( cad_route_map *self ) { uint32_t queuesize = self->sys->queue.size(); uint32_t vrb; for (uint32_t _t = 0; _t < queuesize; _t++) { uint32_t i = (uint32_t)(self->sys->queue.front() >> 32); uint32_t j = self->sys->queue.front() & ((1LL << 32) - 1); self->sys->queue.pop_front(); uint32_t result ; uint32_t val = MapElement3D(self, i, j, self->currerntLayer); vrb = 0; if ( (val & MAP_NUMBER) == MAP_NUMBER ) { vrb = val & NUMBER_MASK; } vrb |= MAP_NUMBER; result = SetPoint(self, i + 0, j + 1, MAP_ARROW_LEFT | vrb ); if (result != MORE_ACTIONS_IN_DEMO_MODE) return result; result = SetPoint(self, i + 0, j - 1, MAP_ARROW_RIGHT | vrb ); if (result != MORE_ACTIONS_IN_DEMO_MODE) return result; result = SetPoint(self, i + 1, j + 0, MAP_ARROW_UP | vrb ); if (result != MORE_ACTIONS_IN_DEMO_MODE) return result; result = SetPoint(self, i - 1, j + 0, MAP_ARROW_DOWN | vrb ); if (result != MORE_ACTIONS_IN_DEMO_MODE) return result; } return MORE_ACTIONS_IN_DEMO_MODE; }
int main(){ // define dois pontos arbitrarios point *p1, *p2; bufferdevice * dispositivo; palette * palheta; window * janela; SetWorld(0, 30, 0, 30); // Define o tamanho do mundo dispositivo = CreateBuffer(640,480); // cria um dispositivo palheta = CreatePalette(6); SetColor(0,0,0,palheta); SetColor(1,0,0,palheta); SetColor(0,1,0,palheta); SetColor(0,0,1,palheta); SetColor(1,1,1,palheta); p1 = SetPoint(5, 5, 1); p2 = SetPoint(10,4, 1); janela = CreateWindow(0, 10, 0, 10); DrawLine(p1, p2, janela, dispositivo, 1); DumpX(dispositivo, palheta); return 0; }
int CNode::Process(CPlayer *pPlayer, int iPointId, int iLastPoint, int iType, CVector3 vecVelocity) { int iChangeNode = 0; // Set the node to the player point SetPoint(iPointId); // Set it to the next link unsigned short usStartLink = GetLinkId(); unsigned short usLinkCount = GetLinkCount(); BYTE byteCount = 0; // Do we need to change the node ? while(!iChangeNode) { // Generate a random link id unsigned short usLinkId = usStartLink + (rand() % usLinkCount); // Set the node to the next random link SetLink(usLinkId); // Keep looping until we get a differente link point while(m_nodeLink.usNodeId == iLastPoint && usLinkCount > 1) { // Increase the attempts count byteCount++; if(byteCount > 10) break; // Generate a random link id unsigned short usLinkId = usStartLink + (rand() % usLinkCount); // Set the node to the next random link SetLink(usLinkId); } // Check if we need to change the node id if(m_nodeLink.usAreaId != m_iNodeId) { if(m_nodeLink.usAreaId != 65535) { if((iChangeNode = CCallbackManager::OnChangeNode(pPlayer->GetId(), (int)m_nodeLink.usAreaId))) return pPlayer->ChangeNode(m_nodeLink.usAreaId, usLinkId); } else return 0; } else { // Set the next point SetPoint(m_nodeLink.usNodeId); // Get the point position CVector3 vecPosition; GetPosition(&vecPosition); // Set the player velocity pPlayer->SetVelocity(vecVelocity); // Move the player to it pPlayer->GoTo(vecPosition, iType == NODE_TYPE_PED ? MOVE_TYPE_WALK : MOVE_TYPE_DRIVE, true); return m_nodeLink.usNodeId; } } return 0; }
STEP( class STONE *ps, PCVECTOR pvo, PCVECTOR pvn, RCOORD from, RCOORD to ) { SetPoint( l.d.n, pvn ); SetPoint( l.d.o, pvo ); l.dFrom = from; l.dTo = to; l.pStuff = (void*)ps; // point to stone this started on.... l.pOtherStuff = NULL; // later we can mate it to others... }
//Alterar int DrawObject(object * ob, window * win, bufferdevice * dev) { int i; float aux; point * p1, * p2, * paux; for(i=0;i<ob->numbers_of_points;i++) { p1 = SetPoint(ob->points[i].x,ob->points[i].y,ob->points[i].color); p2 = SetPoint(ob->points[(i+1)%ob->numbers_of_points].x,ob->points[(i+1)%ob->numbers_of_points].y,ob->points[(i+1)%ob->numbers_of_points].color); if (p1->y > p2->y) { aux = p1->y; p1->y = p2->y; p2->y = aux; aux = p1->x; p1->x = p2->x; p2->x = aux; } if ((p1->y < win->ymax)&&(p2->y > win->ymax)) { paux = InterY(p1,p2,win->ymax); if (InWin(paux,win)) { p2 = paux; } } if ((p1->y < win->ymin)&&(p2->y > win->ymin)) { paux = InterY(p1,p2,win->ymin); if (InWin(paux,win)) { p1 = paux; } } if (p1->x > p2->x) { aux = p1->y; p1->y = p2->y; p2->y = aux; aux = p1->x; p1->x = p2->x; p2->x = aux; } if ((p1->x < win->xmax)&&(p2->x > win->xmax)) { paux = InterX(p1,p2,win->xmax); if (InWin(paux,win)) { p2 = paux; } } if ((p1->x < win->xmin)&&(p2->x > win->xmin)) { paux = InterX(p1,p2,win->xmin); if (InWin(paux,win)) { p1 = paux; } } if ((InWin(p1,win))&&(InWin(p2,win))) DrawLine(p1,p2,win,dev,p1->color); } return 0; }
void XDrawRoundRect(Display *disp, Window win, GC gc, int x, int y, int w, int h) { #define RAD (OFFS_X/2) #define SetPoint(pn, x0, y0) pn.x = x0; pn.y = y0 if ((w < 10) || (h < 10)) { XDrawRectangle(disp, win, gc, x, y, w, h); } else { XPoint p[9]; SetPoint(p[0], x+RAD, y); SetPoint(p[1], w-2*RAD, 0); SetPoint(p[2], RAD, RAD); SetPoint(p[3], 0, h-2*RAD); SetPoint(p[4], -RAD, RAD); SetPoint(p[5], 2*RAD-w, 0); SetPoint(p[6], -RAD, -RAD); SetPoint(p[7], 0, 2*RAD-h); SetPoint(p[8], RAD, -RAD); XDrawLines(disp, win, gc, p, 9, CoordModePrevious); } }
int main(int argc, char ** argv) { palette * palheta; bufferdevice * dispositivo; window * janela; object * poligono1, * poligono2, * poligono3; SetWorld(-20, 10, -20, 15); // Define o tamanho do mundo dispositivo = CreateBuffer(640,480); // cria um dispositivo palheta = CreatePalette(4); SetColor(0,0,0,palheta); SetColor(1,0,0,palheta); SetColor(0,0,1,palheta); SetColor(1,1,0,palheta); poligono1 = CreateObject(5); poligono2 = CreateObject(4); SetObject(SetPoint(-9.0,-8.0,1), poligono1); SetObject(SetPoint(-7.0,-3.0,1), poligono1); SetObject(SetPoint(-4.0,-4.0,1), poligono1); SetObject(SetPoint(-3.0,-6.0,1), poligono1); SetObject(SetPoint(-6.0,-9.0,1), poligono1); SetObject(SetPoint(-6.0,-2.0,2), poligono2); SetObject(SetPoint(-1.0,-2.0,2), poligono2); SetObject(SetPoint(-1.0,-6.0,2), poligono2); SetObject(SetPoint(-6.0,-6.0,2), poligono2); poligono1 = Translate(poligono1,5,5); // centraliza em relação a origem do sistema poligono2 = Translate(poligono2,5,5); poligono3 = Translate(poligono2,-1.5,-1.0); poligono3 = Rotate(poligono3,45); poligono3 = Translate(poligono3,1.5,1.0); poligono3 = ChangeColor(poligono3,3); poligono1 = Scale(poligono1,0.4,0.4); poligono2 = Scale(poligono2,0.4,0.4); poligono3 = Scale(poligono3,0.4,0.4); janela = CreateWindow(-2.0,2.0,-2.0,2.0); // define uma janela de visualização DrawObject(poligono1,janela,dispositivo); // desenha o poligono 1 dentro da janela no buffer do dispositivo DrawObject(poligono2,janela,dispositivo); // desenha o poligono 2 dentro da janela no buffer do dispositivo DrawObject(poligono3,janela,dispositivo); // desenha o poligono 3 dentro da janela no buffer do dispositivo /* * O sistema RGB é aditivo pois cada cor nesse modelo é representada por uma soma ponderada de três componentes * primárias (o vermelho, o verde e o azul). */ DumpX(dispositivo,palheta); // desenha o buffer na tela //DumpOpenGL(argc,argv,dispositivo,palheta); return 0; }
void Monster::SetGridPos(int x, int y) { POINT pt; pt.x = x * CXTILE; pt.y = y * CYTILE; SetPoint(pt); }
int scSelection::PrevEntireLine( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; scTextline* prevTxl; if ( mark.fTxl ) { prevTxl = mark.fTxl->GetPrevLogical(); if ( !prevTxl ) return 0; mark.fTxl = prevTxl; point = mark; mark.SelectStartLine( ); point.SelectEndLine( ); } SetMark( mark ); SetPoint( point ); return mark.fTxl != 0; }
int scSelection::NextSpellWord( Scope scope ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; UCS2 ch = PARACharAtOffset( point.fPara, point.fOffset ); if ( !CTIsSpace( ch ) ) point.SelectEndSpellWord( ); if ( !IsSliverCursor() ) { while ( !point.SelectNextSpellWord( ) ) { if ( scope == inContUnit ) return 0; point.fPara = point.fPara->GetNext(); if ( !point.fPara ) return 0; point.fOffset = 0; } mark = point; if ( !mark.SelectStartSpellWord( ) || !point.SelectEndSpellWord( ) ) return 0; } SetMark( mark ); SetPoint( point ); return mark.fPara != 0 && !IsSliverCursor(); }
int scSelection::PrevSpellWord( Scope scope ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; if ( CTIsAlpha( PARACharAtOffset( mark.fPara, mark.fOffset ) ) ) mark.SelectStartSpellWord( ); while ( !mark.SelectPrevSpellWord( ) ) { if ( scope == inContUnit ) return 0; mark.fPara = mark.fPara->GetPrev(); if ( !mark.fPara ) return 0; mark.fOffset = PARAChSize( mark.fPara ); } point = mark; mark.SelectStartSpellWord( ); point.SelectEndSpellWord( ); SetMark( mark ); SetPoint( point ); return mark.fPara != 0; }
int scSelection::StartColumn( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; if ( !mark.fCol ) { scContUnit* lastPara = mark.fPara->GetPrevVisiblePara(); scTextline* txl = lastPara->GetFirstline(); if ( lastPara && txl ) { mark.fCol = txl->GetColumn(); mark.fPara = lastPara; mark.fTxl = txl; } else return 0; } mark.SelectStartColumn(); point = mark; SetMark( mark ); SetPoint( point ); return mark.fCol != 0; }
int scSelection::EndColumn( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; if ( !point.fCol ) { scContUnit* lastPara = point.fPara->GetPrevVisiblePara(); scTextline* lastTxl = 0; if ( lastPara ) lastTxl = lastPara->GetLastVisibleLine(); if ( lastPara && lastTxl ) { point.fCol = lastTxl->GetColumn(); point.fPara = lastPara; point.fTxl = lastTxl; } else return 0; } point.SelectEndColumn( ); mark = point; SetMark( mark ); SetPoint( point ); return mark.fCol != 0; }
void CXTPPropertyGridItemPoint::OnBeforeInsert() { if (m_pBindPoint && *m_pBindPoint != m_ptValue) { SetPoint(*m_pBindPoint); } }
int main() { struct point p; p.x = p.y = p.z = 1; int i = 0; for(; i < 1000; ++i) { g_points[i] = create_atomic_type(sizeof(p)); SetPoint(g_points[i],p); } thread_t t1 = CREATE_THREAD_RUN(1,SetRotine,NULL); thread_t t2 = CREATE_THREAD_RUN(1,GetRoutine,(void*)1); thread_t t3 = CREATE_THREAD_RUN(1,GetRoutine,(void*)2); thread_t t4 = CREATE_THREAD_RUN(1,GetRoutine,(void*)3); uint32_t tick = GetSystemMs(); while(1) { uint32_t new_tick = GetSystemMs(); if(new_tick - tick >= 1000) { printf("get:%d,set:%d,miss:%d\n",get_count,set_count,miss_count); get_count = set_count = miss_count = 0; tick = new_tick; } sleepms(50); } }
RADAR::RADAR( RCOORD distance, PCVECTOR o ) { T.clear(); power = distance; speed = (RCOORD)_5; // used to be 0.10 and was close to this.... p = (RCOORD)0.0; distance = 0; neural_p = 0; Right = 0; Left = 0; SetPoint( Lines[0].d.o, o ); // set origin on body... Lines[0].dFrom = 0; Lines[0].dTo = 1.0; // power failure.... 100 % power... Lines[0].pStuff = NULL; Lines[0].pOtherStuff = NULL; Lines[0].bUsed = TRUE; Lines[0].bDraw = TRUE; LinePool.pLines = Lines; LinePool.nLines = 1; LinePool.nUsedLines = 1; Visual.pPlaneSet = NULL; Visual.pLinePool = &LinePool; Visual.pNext = &Visual; Visual.pPrior = &Visual; Visual.pIn = NULL; Visual.pHolds = NULL; Move(); // finish update of compational variables... }
RCOORD inline PointToPlaneT( PVECTOR n, PVECTOR o, PVECTOR p ) { VECTOR i; RCOORD t; SetPoint( i, n ); Invert( i ); IntersectLineWithPlane( i, p, n, o, &t ); return t; }
// ============================================================================ LRESULT AngleControl::MouseMove(int xPos, int yPos, int fwKeys) { POINT pnt; if(m_lButtonDown && (fwKeys & MK_LBUTTON)) { if(fwKeys & MK_SHIFT || fwKeys & MK_CONTROL) SetPoint(xPos, yPos, TRUE); else SetPoint(xPos, yPos); SetCapture(m_hWnd); GetCursorPos(&pnt); SendMessage(m_hToolTip, TTM_TRACKPOSITION, 0, (LPARAM)MAKELPARAM(pnt.x, pnt.y)); } return 0; }
PointOnSphere::PointOnSphere(const Vertex3& center, const Vertex3& pointInSphere) : center_(center), radius_(Distance(center, pointInSphere)), theta_(0), phi_(0) { SetPoint(pointInSphere); }
void InputEntity::SetLabel(std::string text) { if(NULL != label) label->SetText(text); else label = new TextEntity(text, FONT_SIZE_NORMAL); SetPoint(GetPoint()); }
// сделать 1 шаг обхода в ширину uint32_t ContinueWave( cad_route_map *self ) { uint32_t queuesize = self->sys->queue.size(); for (uint32_t _t = 0; _t < queuesize; _t++) { uint32_t i = (uint32_t)(self->sys->queue.front() >> 32); uint32_t j = self->sys->queue.front() & ((1LL << 32) - 1); self->sys->queue.pop_front(); uint32_t result ; result = SetPoint(self, i + 0, j + 1, MAP_ARROW_LEFT ); if (result != MORE_ACTIONS_IN_DEMO_MODE) return result; result = SetPoint(self, i + 0, j - 1, MAP_ARROW_RIGHT ); if (result != MORE_ACTIONS_IN_DEMO_MODE) return result; result = SetPoint(self, i + 1, j + 0, MAP_ARROW_UP ); if (result != MORE_ACTIONS_IN_DEMO_MODE) return result; result = SetPoint(self, i - 1, j + 0, MAP_ARROW_DOWN ); if (result != MORE_ACTIONS_IN_DEMO_MODE) return result; } return MORE_ACTIONS_IN_DEMO_MODE; }
void InputEntity::SetValue(std::string text) { if(NULL != input) input->SetText(text); else input = new TextEntity(text, FONT_SIZE_TINY, FONT_TYPE_CONSOLE); current = text; SetPoint(GetPoint()); // FIXME: crappy }
void Curve::Reset(void) { for (int i = 0; i < sampleCount; i++) { samples[i] = (double)i / (double)(sampleCount - 1); tables[i] = (uint8)ROUND(samples[i] * 255); } SetPoint(0, 0.0, 0.0); for (int i = 1; i < pointCount - 1; i++) { SetPoint(i, -1.0, -1.0); } SetPoint(pointCount - 1, 1.0, 1.0); identity = true; }
OVL_EXTERN brkp *TypePoint( memory_expr def_seg ) { mad_type_handle th; th = ScanType( MAS_MEMORY | MTK_ALL, NULL ); if( th == MAD_NIL_TYPE_HANDLE ) { BadPoint( def_seg ); } return( SetPoint( def_seg, th ) ); }
//Alterar object * Scale(object * ob, float sx, float sy) { object * oob; int i; oob = CreateObject(ob->numbers_of_points); for(i=0;i<ob->numbers_of_points;i++) { SetObject(SetPoint(sx*(ob->points[i].x),sy*(ob->points[i].y),ob->points[i].color),oob); } return oob; }
//OK object * ChangeColor(object * ob, int color) { object * oob; int i; oob = CreateObject(ob->numbers_of_points); for(i=0;i<ob->numbers_of_points;i++) { SetObject(SetPoint(ob->points[i].x,ob->points[i].y,color),oob); } return oob; }
//Alterar object * Translate(object * ob, float x, float y) { object * oob; int i; oob = CreateObject(ob->numbers_of_points); for(i=0;i<ob->numbers_of_points;i++) { SetObject(SetPoint(ob->points[i].x + x,ob->points[i].y + y,ob->points[i].color),oob); } return oob; }
// ============================================================================ LRESULT AngleControl::LButtonDown(int xPos, int yPos, int fwKeys) { float rad = m_diameter * 0.5f; float x = xPos - rad; float y = yPos - rad; if((x*x + y*y) <= rad*rad) { m_lButtonDown = TRUE; m_oldCursor = ::SetCursor(MAXScript_interface->GetSysCursor(SYSCUR_ROTATE)); SetCapture(m_hWnd); if(fwKeys & MK_SHIFT || fwKeys & MK_CONTROL) SetPoint(xPos, yPos, TRUE); else SetPoint(xPos, yPos); return 0; } return 1; }
int scSelection::NextLine( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; scTextline* nextTxl; if ( point.fTxl ) { nextTxl = point.fTxl; do { nextTxl = nextTxl->GetNextLogical(); } while ( nextTxl && SameBaseline( point.fTxl, nextTxl ) ); if ( !nextTxl ) return 0; nextTxl = SearchRight( nextTxl, point.fSelMaxX ); if ( !nextTxl ) return 0; point.fTxl = nextTxl; SelectLocateOnLine( &point, eCursForward ); mark = point; } else if ( mark.fTxl ) { nextTxl = mark.fTxl; do { nextTxl = nextTxl->GetNextLogical(); } while ( nextTxl && SameBaseline( mark.fTxl, nextTxl ) ); if ( !nextTxl ) return 0; nextTxl = SearchRight( nextTxl, mark.fSelMaxX ); if ( !nextTxl ) return 0; point.fTxl = nextTxl; SelectLocateOnLine( &mark, eCursForward ); point = mark; } SetMark( mark ); SetPoint( point ); return mark.fTxl != 0; }
int scSelection::PrevLine( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; scTextline* prevTxl; if ( mark.fTxl ) { prevTxl = mark.fTxl; do { prevTxl = prevTxl->GetPrevLogical(); } while ( prevTxl && SameBaseline( mark.fTxl, prevTxl ) ); if ( !prevTxl ) return 0; prevTxl = SearchLeft( prevTxl, mark.fSelMaxX ); if ( !prevTxl ) return 0; mark.fTxl = prevTxl; SelectLocateOnLine( &mark, eCursBackward ); point = mark; } else if ( point.fTxl ) { prevTxl = point.fTxl; do { prevTxl = prevTxl->GetPrevLogical(); } while ( prevTxl && SameBaseline( point.fTxl, prevTxl ) ); if ( !prevTxl ) return 0; prevTxl = SearchLeft( prevTxl, point.fSelMaxX ); if ( !prevTxl ) return 0; point.fTxl = prevTxl; SelectLocateOnLine( &point, eCursBackward ); mark = point; } SetMark( mark ); SetPoint( point ); return mark.fTxl != 0; }