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::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 CShadePickerCtrl::OnLButtonDown(UINT nFlags, CPoint point) { SetCapture(); m_Dragging = TRUE; SetMark(point); CStatic::OnLButtonDown(nFlags, point); }
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::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::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; }
void emMinesFileModel::InvertMark(int x, int y, int z, bool saveFile) { int f; f=GetField(x,y,z); if ((f&4)==0) SetMark(x,y,z,saveFile); else RemoveMark(x,y,z,saveFile); }
void CShadePickerCtrl::OnLButtonUp(UINT nFlags, CPoint point) { if (m_Dragging) { ReleaseCapture(); m_Dragging = FALSE; SetMark(point); } CStatic::OnLButtonUp(nFlags, point); }
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; }
int scSelection::EndPara( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; point.fOffset = PARAChSize( point.fPara ); mark = point; SetMark( mark ); SetPoint( point ); return mark.fPara != 0; }
int scSelection::StartWord( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; if ( !mark.SelectStartWord( ) ) return 0; point = mark; SetMark( mark ); SetPoint( point ); return mark.fPara != 0; }
int scSelection::BeginPara( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; mark.fOffset = 0; point = mark; SetMark( mark ); SetPoint( point ); return mark.fPara != 0; }
int scSelection::StartLine( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; if ( mark.fTxl ) { mark.SelectStartLine(); point = mark; SetMark( mark ); SetPoint( point ); } return mark.fTxl != 0; }
int scSelection::EndWord( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; if ( !point.SelectEndWord( ) ) return 0; mark = point; SetMark( mark ); SetPoint( point ); return mark.fPara != 0; }
int scSelection::NextColumn() { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; scColumn* nextCol; if ( !point.fCol ) { scContUnit* lastPara = point.fPara->GetPrevVisiblePara(); scTextline* lastTxl = lastPara->GetLastVisibleLine(); if ( lastPara && lastTxl ) { point.fCol = lastTxl->GetColumn(); point.fPara = lastPara; point.fTxl = lastTxl; } else return 0; } nextCol = point.fCol->GetNext(); /* check to see if we have a next column */ if ( !nextCol ) return 0; if ( !nextCol->GetFirstline() ) return 0; point.fCol = nextCol; point.fTxl = nextCol->GetFirstline(); point.fPara = point.fTxl->GetPara(); mark = point; mark.SelectStartColumn(); point.SelectEndColumn(); SetMark( mark ); SetPoint( point ); return mark.fCol != 0; }
int scSelection::PrevWord( Scope scope ) { TextMarker& point = fPoint; while ( !point.SelectPrevWord() ) { if ( scope == inContUnit ) return 0; point.fPara = point.fPara->GetPrev(); if ( !point.fPara ) return 0; point.fOffset = PARAChSize( point.fPara ); } point.SelectStartWord( ); SetMark( point ); SetPoint( point ); return point.fPara != 0; }
void dgConvexHull4dTetraherum::Init (const dgHullVector* const points, dgInt32 v0, dgInt32 v1, dgInt32 v2, dgInt32 v3) { //{0, 1, 2, 3}, //{3, 0, 2, 1}, //{3, 2, 1, 0}, //{3, 1, 0, 2} m_faces[0].m_index[0] = v0; m_faces[0].m_index[1] = v1; m_faces[0].m_index[2] = v2; m_faces[0].m_index[3] = v3; m_faces[1].m_index[0] = v3; m_faces[1].m_index[1] = v0; m_faces[1].m_index[2] = v2; m_faces[1].m_index[3] = v1; m_faces[2].m_index[0] = v3; m_faces[2].m_index[1] = v2; m_faces[2].m_index[2] = v1; m_faces[2].m_index[3] = v0; m_faces[3].m_index[0] = v3; m_faces[3].m_index[1] = v1; m_faces[3].m_index[2] = v0; m_faces[3].m_index[3] = v2; SetMark (0); for (dgInt32 i = 0; i < 4; i ++) { m_faces[i].m_twin = NULL; } #ifdef _DEBUG dgBigVector p1p0 (points[v1] - points[v0]); dgBigVector p2p0 (points[v2] - points[v0]); dgBigVector p3p0 (points[v3] - points[v0]); dgBigVector normal (p1p0.CrossProduct4(p2p0, p3p0)); dgFloat64 volume = normal.DotProduct4(normal).m_x; dgAssert (volume > dgFloat64 (0.0f)); #endif }
void emMinesFileModel::StartGame( int sizeX, int sizeY, int sizeZ, int mineCount, bool saveFile ) { int i,j,k,x,y,fcnt; ExtraDataValid=false; SizeX=sizeX; SizeY=sizeY; SizeZ=sizeZ; // Because they may have been clipped by the above assignments. sizeX=SizeX; sizeY=SizeY; sizeZ=SizeZ; fcnt=sizeX*sizeY*sizeZ; Fields.SetCount(fcnt); for (i=0; i<fcnt; i++) Fields[i].Set(0); if (mineCount>fcnt) mineCount=fcnt; for (i=0; i<mineCount; i++) { j=emGetIntRandom(0,fcnt-i-1); for (k=0; ; k++) { if (Fields[k].Get()==0) { j--; if (j<0) { Fields[k].Set(1); break; } } } } if (SizeZ>1) { for (y=0; y<SizeY; y++) for (x=0; x<SizeX; x++) { if (IsMine(x,y,0)) SetMark(x,y,0,false); else OpenField(x,y,0,false); } } if (saveFile) Save(true); }
int scSelection::NextWord( Scope scope ) { TextMarker point = fPoint; if ( CTIsSelectable( PARACharAtOffset( point.fPara, point.fOffset ) ) ) point.SelectEndWord( ); while ( !point.SelectNextWord( ) ) { if ( scope == inContUnit ) return 0; point.fPara = point.fPara->GetNext(); if ( !point.fPara ) return 0; point.fOffset = 0; } point.SelectStartWord(); SetMark( point ); SetPoint( point ); return point.fPara != 0; }
int scSelection::EndLine( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; if ( point.fTxl ) { point.SelectEndLine( ); mark = point; } else if ( mark.fTxl ) { mark.SelectEndLine(); point = mark; } SetMark( mark ); SetPoint( point ); return mark.fTxl != 0; }
int scSelection::NextEntireLine( ) { scSelection sortedSelect( *this ); sortedSelect.Sort(); TextMarker& mark = sortedSelect.fMark; TextMarker& point = sortedSelect.fPoint; scTextline* nextTxl; if ( point.fTxl ) { nextTxl = point.fTxl->GetNextLogical(); if ( !nextTxl ) return 0; point.fTxl = nextTxl; mark = point; mark.SelectStartLine(); point.SelectEndLine(); } else if ( mark.fTxl ) { nextTxl = mark.fTxl->GetNextLogical(); if ( !nextTxl ) return 0; mark.fTxl = nextTxl; point = mark; mark.SelectStartLine(); point.SelectEndLine(); } SetMark( mark ); SetPoint( point ); return mark.fTxl != 0; }
void CShadePickerCtrl::OnMouseMove(UINT nFlags, CPoint point) { if (m_Dragging) SetMark(point); CStatic::OnMouseMove(nFlags, point); }
unsigned WarpTime(void) { int e; int l; short key; short field; int exit; SaveScreen(); DrawPup(&cwarp); SetMark(&cwarpitems[W_RESPAWN],respawn); SetMark(&cwarpitems[W_NOMON],nomonsters); #ifndef HERETIC SetMark(&cwarpitems[W_DM2],deathmatch2); #endif exit = 0; while(1) { SetupMenu(&cwarpmenu); field = GetMenuInput(); key = menukey; switch(key) { case KEY_ESC: RestoreScreen(); return 0; case KEY_F10: case KEY_ENTER: switch(field) { case E1M1: e=1;l=1; exit=1; break; case E1M2: e=1;l=2; exit=1; break; case E1M3: e=1;l=3; exit=1; break; case E1M4: e=1;l=4; exit=1; break; case E1M5: e=1;l=5; exit=1; break; case E1M6: e=1;l=6; exit=1; break; case E1M7: e=1;l=7; exit=1; break; case E1M8: e=1;l=8; exit=1; break; case E1M9: e=1;l=9; exit=1; break; #ifdef DOOM2 case E1M10: e=1;l=10; exit=1; break; #endif case E2M1: e=2;l=1; exit=1; break; case E2M2: e=2;l=2; exit=1; break; case E2M3: e=2;l=3; exit=1; break; case E2M4: e=2;l=4; exit=1; break; case E2M5: e=2;l=5; exit=1; break; case E2M6: e=2;l=6; exit=1; break; case E2M7: e=2;l=7; exit=1; break; case E2M8: e=2;l=8; exit=1; break; case E2M9: e=2;l=9; exit=1; break; #ifdef DOOM2 case E2M10: e=2;l=10; exit=1; break; #endif case E3M1: e=3;l=1; exit=1; break; case E3M2: e=3;l=2; exit=1; break; case E3M3: e=3;l=3; exit=1; break; case E3M4: e=3;l=4; exit=1; break; case E3M5: e=3;l=5; exit=1; break; case E3M6: e=3;l=6; exit=1; break; case E3M7: e=3;l=7; exit=1; break; case E3M8: e=3;l=8; exit=1; break; case E3M9: e=3;l=9; exit=1; break; #ifdef DOOM2 case E3M10: e=3;l=10; exit=1; break; #endif case W_RESPAWN: respawn ^= 1; SetMark(&cwarpitems[W_RESPAWN],respawn); break; case W_NOMON: nomonsters ^= 1; SetMark(&cwarpitems[W_NOMON],nomonsters); break; #ifndef HERETIC case W_DM2: deathmatch2 ^= 1; SetMark(&cwarpitems[W_DM2],deathmatch2); break; #endif } if (exit) { RestoreScreen(); #ifdef DOOM2 return ((e-1)*10+l); #else return (e<<8)+l; #endif } } } }