void CLightning::DamageThink( void ) { pev->nextthink = gpGlobals->time + 0.1; TraceResult tr; UTIL_TraceLine( GetStartPos(), GetEndPos(), dont_ignore_monsters, NULL, &tr ); BeamDamage( &tr ); }
bool WORKSHEET_DATAITEM_POLYPOLYGON::IsInsidePage( int ii ) const { DPOINT pos = GetStartPos( ii ); pos += m_minCoord; // left top pos of bounding box if( m_LT_Corner.x > pos.x || m_LT_Corner.y > pos.y ) return false; pos = GetStartPos( ii ); pos += m_maxCoord; // rignt bottom pos of bounding box if( m_RB_Corner.x < pos.x || m_RB_Corner.y < pos.y ) return false; return true; }
void WORKSHEET_DATAITEM::MoveTo( DPOINT aPosition ) { DPOINT vector = aPosition - GetStartPos(); DPOINT endpos = vector + GetEndPos(); MoveStartPointTo( aPosition ); MoveEndPointTo( endpos ); }
bool DimensionDrawing::calculate_item(DigitizedPoint &end) { if(end.m_type == DigitizeNoItemType)return false; if(temp_object && temp_object->GetType() != DimensionType){ delete temp_object; temp_object = NULL; temp_object_in_list.clear(); } gp_Trsf mat = wxGetApp().GetDrawMatrix(true); // make sure dimension exists if(!temp_object){ temp_object = new HDimension(mat, gp_Pnt(0, 0, 0), gp_Pnt(0, 0, 0), gp_Pnt(0, 0, 0), m_mode, DimensionUnitsGlobal, &(wxGetApp().current_color)); if(temp_object)temp_object_in_list.push_back(temp_object); } gp_Pnt p0, p1, p2; if(GetDrawStep() == 1) { p0 = GetStartPos().m_point; p1 = end.m_point; p2 = end.m_point; } else if(GetDrawStep() == 2) { p0 = GetBeforeStartPos().m_point; p1 = GetStartPos().m_point; p2 = end.m_point; } else { return false; } // double distance = p0.Distance(p1); ((HDimension*)temp_object)->m_trsf = mat; ((HDimension*)temp_object)->A->m_p = p0; ((HDimension*)temp_object)->B->m_p = p1; ((HDimension*)temp_object)->m_p2->m_p = p2; ((HDimension*)temp_object)->m_mode = m_mode; return true; }
void CLaser::FireAtPoint(TraceResult &tr) { SetEndPos(tr.vecEndPos); if(m_pSprite) UTIL_SetOrigin(m_pSprite->pev, tr.vecEndPos); BeamDamage(&tr); DoSparks(GetStartPos(), tr.vecEndPos); }
const DPOINT WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPosition( unsigned aIdx, int aRepeat ) const { DPOINT pos = m_Corners[aIdx]; // Rotation: RotatePoint( &pos.x, &pos.y, m_Orient * 10 ); pos += GetStartPos( aRepeat ); return pos; }
void CBeam::SetObjectCollisionBox( void ) { const Vector &startPos = GetStartPos(), &endPos = GetEndPos(); pev->absmin.x = min( startPos.x, endPos.x ); pev->absmin.y = min( startPos.y, endPos.y ); pev->absmin.z = min( startPos.z, endPos.z ); pev->absmax.x = max( startPos.x, endPos.x ); pev->absmax.y = max( startPos.y, endPos.y ); pev->absmax.z = max( startPos.z, endPos.z ); }
void CBeam::RelinkBeam( void ) { const Vector &startPos = GetStartPos(), &endPos = GetEndPos(); pev->mins.x = min( startPos.x, endPos.x ); pev->mins.y = min( startPos.y, endPos.y ); pev->mins.z = min( startPos.z, endPos.z ); pev->maxs.x = max( startPos.x, endPos.x ); pev->maxs.y = max( startPos.y, endPos.y ); pev->maxs.z = max( startPos.z, endPos.z ); pev->mins = pev->mins - pev->origin; pev->maxs = pev->maxs - pev->origin; UTIL_SetSize( pev, pev->mins, pev->maxs ); UTIL_SetOrigin( pev, pev->origin ); }
bool WORKSHEET_DATAITEM::IsInsidePage( int ii ) const { DPOINT pos = GetStartPos( ii ); for( int kk = 0; kk < 1; kk++ ) { if( m_RB_Corner.x < pos.x || m_LT_Corner.x > pos.x ) return false; if( m_RB_Corner.y < pos.y || m_LT_Corner.y > pos.y ) return false; pos = GetEndPos( ii ); } return true; }
void CLightning::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !ShouldToggle( useType, m_active ) ) return; if ( m_active ) { m_active = 0; pev->effects |= EF_NODRAW; pev->nextthink = 0; } else { m_active = 1; pev->effects &= ~EF_NODRAW; DoSparks( GetStartPos(), GetEndPos() ); if ( pev->dmg > 0 ) { pev->nextthink = gpGlobals->time; pev->dmgtime = gpGlobals->time; } } }
const wxPoint WORKSHEET_DATAITEM::GetStartPosUi( int ii ) const { DPOINT pos = GetStartPos( ii ); pos = pos * m_WSunits2Iu; return wxPoint( int(pos.x), int(pos.y) ); }
static int edtProcessKeyDown( HWND hWnd, WPARAM wParam, LPARAM lParam ) { PWindowsTree pWin; PSLEditData pEditData; BOOL bChange, bScroll; int iNewStartPos; int scrollStep,moveStep,deleted; int iLimit; RECT InvRect; pWin = (PWindowsTree)hWnd; if(!pWin) return -1; pEditData = (PSLEditData)(pWin->dwData); if(!pEditData) return -1; bChange = false; switch(LOWORD(wParam)){ case SCANCODE_ENTER: NotifyParent (hWnd, EN_ENTER); break; case SCANCODE_HOME: if (pEditData->iEditPos == 0) break; pEditData->iEditPos = 0; pEditData->iCaretPos = 0; SetCaretPos (hWnd, pEditData->iCaretPos * GetSysCharWidth () + pEditData->iLeftMargin, pEditData->iTopMargin); if (pEditData->iStartPos != 0) InvalidateRect (hWnd, NULL, TRUE); pEditData->iStartPos = 0; break; case SCANCODE_END: if (pEditData->iEditPos == pEditData->iDataLen) return 0; iNewStartPos = GetStartPos (hWnd, pEditData); pEditData->iEditPos = pEditData->iDataLen; pEditData->iCaretPos = pEditData->iEditPos - iNewStartPos; SetCaretPos (hWnd, pEditData->iCaretPos * GetSysCharWidth () + pEditData->iLeftMargin, pEditData->iTopMargin); if (pEditData->iStartPos != iNewStartPos) InvalidateRect (hWnd, NULL, TRUE); pEditData->iStartPos = iNewStartPos; break; case SCANCODE_LEFT: // bScroll = FALSE; if (pEditData->iEditPos == 0) return 0; if (IsACCharBeforePos (pEditData->buffer, pEditData->iEditPos)) { scrollStep = 2; pEditData->iEditPos -= 2; } else { scrollStep = 1; pEditData->iEditPos --; } pEditData->iCaretPos -= scrollStep; if (pEditData->iCaretPos == 0 && pEditData->iEditPos != 0) { bScroll = TRUE; if (IsACCharBeforePos(pEditData->buffer, pEditData->iEditPos)) { pEditData->iStartPos -= 2; pEditData->iCaretPos = 2; } else{ pEditData->iStartPos --; pEditData->iCaretPos = 1; } } else if (pEditData->iCaretPos < 0) { pEditData->iStartPos = 0; pEditData->iCaretPos = 0; } SetCaretPos (hWnd, pEditData->iCaretPos * GetSysCharWidth () + pEditData->iLeftMargin, pEditData->iTopMargin); if (bScroll) InvalidateRect (hWnd, NULL, TRUE); break; case SCANCODE_RIGHT: bScroll = FALSE; if (pEditData->iEditPos == pEditData->iDataLen) return 0; if (IsACCharAtPos (pEditData->buffer, pEditData->iDataLen, pEditData->iStartPos)) { if (IsACCharAtPos (pEditData->buffer, pEditData->iDataLen, pEditData->iEditPos)) { scrollStep = 2; moveStep = 2; pEditData->iEditPos += 2; } else { scrollStep = 2; moveStep = 1; pEditData->iEditPos ++; } } else {// isn't a chinese character at start position if (IsACCharAtPos (pEditData->buffer, pEditData->iDataLen, pEditData->iEditPos)) { if (IsACCharAtPos (pEditData->buffer, pEditData->iDataLen, pEditData->iStartPos + 1)) scrollStep = 3; else scrollStep = 2; moveStep = 2; pEditData->iEditPos += 2; } else { scrollStep = 1; moveStep = 1; pEditData->iEditPos ++; } } iLimit = pWin->rect.right - pWin->rect.left + 1 - 2 * wndGetBorder(hWnd) - pEditData->iLeftMargin - pEditData->iRightMargin; pEditData->iCaretPos += moveStep; if (pEditData->iCaretPos * GetSysCharWidth () > iLimit) { bScroll = TRUE; pEditData->iStartPos += scrollStep; pEditData->iCaretPos = pEditData->iEditPos - pEditData->iStartPos; } SetCaretPos (hWnd, pEditData->iCaretPos * GetSysCharWidth () + pEditData->iLeftMargin, pEditData->iTopMargin); if (bScroll) InvalidateRect (hWnd, NULL, TRUE); break; case SCANCODE_INS: pEditData = (PSLEditData) (pWin->dwData); pEditData->dwStatus ^= EST_REPLACE; break; case SCANCODE_DEL: { int i; pEditData = (PSLEditData) (pWin->dwData); if ((pWin->dwStyle & ES_READONLY) || (pEditData->iEditPos == pEditData->iDataLen)){ return 0; } if (IsACCharAtPos (pEditData->buffer, pEditData->iDataLen, pEditData->iEditPos)) deleted = 2; else deleted = 1; for(i=pEditData->iEditPos; i<pEditData->iDataLen; i++) pEditData->buffer[i] = pEditData->buffer[i+deleted]; //for (i = pEditData->iEditPos; // i < pEditData->iDataLen - deleted; i++) // pEditData->buffer [i] = pEditData->buffer [i + deleted]; pEditData->iDataLen -= deleted; bChange = TRUE; InvRect.left = pEditData->iLeftMargin + pEditData->iCaretPos * GetSysCharWidth (); InvRect.top = pEditData->iTopMargin; InvRect.right = pWin->rect.right - pWin->rect.left; InvRect.bottom = pWin->rect.bottom - pWin->rect.top; InvalidateRect (hWnd, &InvRect, TRUE); break; } case SCANCODE_BACKSPACE: { int i; pEditData = (PSLEditData) (pWin->dwData); if ((pEditData->dwStatus & ES_READONLY) || (pEditData->iEditPos == 0)) { return 0; } if (IsACCharBeforePos (pEditData->buffer, pEditData->iEditPos)) deleted = 2; else deleted = 1; for (i = pEditData->iEditPos - deleted; i < pEditData->iDataLen; i++) pEditData->buffer [i] = pEditData->buffer [i + deleted]; pEditData->iDataLen -= deleted; pEditData->iEditPos -= deleted; bChange = TRUE; pEditData->iCaretPos -= deleted; if (pEditData->iCaretPos == 0 && pEditData->iEditPos != 0) { if (IsACCharBeforePos (pEditData->buffer, pEditData->iEditPos)) { pEditData->iStartPos -= 2; pEditData->iCaretPos = 2; } else { pEditData->iStartPos --; pEditData->iCaretPos = 1; } InvRect.left = pEditData->iLeftMargin; InvRect.top = pEditData->iTopMargin; InvRect.right = pWin->rect.right - pWin->rect.left; InvRect.bottom = pWin->rect.bottom - pWin->rect.top; } else { InvRect.left = pEditData->iLeftMargin + pEditData->iCaretPos * GetSysCharWidth (); InvRect.top = pEditData->iTopMargin; InvRect.right = pWin->rect.right - pWin->rect.left; InvRect.bottom = pWin->rect.bottom - pWin->rect.top; } SetCaretPos (hWnd, pEditData->iCaretPos * GetSysCharWidth () + pEditData->iLeftMargin, pEditData->iTopMargin); InvalidateRect (hWnd, &InvRect, TRUE); break; } } if (bChange) NotifyParent (hWnd, EN_CHANGE); return 0; }
bool Archive::GetComment(Array<wchar> *CmtData) { if (!MainComment) return false; SaveFilePos SavePos(*this); #ifndef SFX_MODULE ushort CmtLength; if (Format==RARFMT14) { Seek(SFXSize+SIZEOF_MAINHEAD14,SEEK_SET); CmtLength=GetByte(); CmtLength+=(GetByte()<<8); } else #endif { if (MainHead.CommentInHeader) { // Old style (RAR 2.9) archive comment embedded into the main // archive header. Seek(SFXSize+SIZEOF_MARKHEAD3+SIZEOF_MAINHEAD3,SEEK_SET); ReadHeader(); } else { // Current (RAR 3.0+) version of archive comment. Seek(GetStartPos(),SEEK_SET); return SearchSubBlock(SUBHEAD_TYPE_CMT)!=0 && ReadCommentData(CmtData); } #ifndef SFX_MODULE // Old style (RAR 2.9) comment header embedded into the main // archive header. if (BrokenHeader) { uiMsg(UIERROR_CMTBROKEN,FileName); return false; } CmtLength=CommHead.HeadSize-SIZEOF_COMMHEAD; #endif } #ifndef SFX_MODULE if (Format==RARFMT14 && MainHead.PackComment || Format!=RARFMT14 && CommHead.Method!=0x30) { if (Format!=RARFMT14 && (CommHead.UnpVer < 15 || CommHead.UnpVer > VER_UNPACK || CommHead.Method > 0x35)) return(false); ComprDataIO DataIO; DataIO.SetTestMode(true); uint UnpCmtLength; if (Format==RARFMT14) { #ifdef RAR_NOCRYPT return(false); #else UnpCmtLength=GetByte(); UnpCmtLength+=(GetByte()<<8); CmtLength-=2; DataIO.SetCmt13Encryption(); CommHead.UnpVer=15; #endif } else UnpCmtLength=CommHead.UnpSize; DataIO.SetFiles(this,NULL); DataIO.EnableShowProgress(false); DataIO.SetPackedSizeToRead(CmtLength); DataIO.UnpHash.Init(HASH_CRC32,1); Unpack CmtUnpack(&DataIO); CmtUnpack.Init(0x10000,false); CmtUnpack.SetDestSize(UnpCmtLength); CmtUnpack.DoUnpack(CommHead.UnpVer,false); if (Format!=RARFMT14 && (DataIO.UnpHash.GetCRC32()&0xffff)!=CommHead.CommCRC) { uiMsg(UIERROR_CMTBROKEN,FileName); return false; } else { byte *UnpData; size_t UnpDataSize; DataIO.GetUnpackedData(&UnpData,&UnpDataSize); #ifdef _WIN_ALL OemToCharBuffA((char *)UnpData,(char *)UnpData,(DWORD)UnpDataSize); #endif CmtData->Alloc(UnpDataSize+1); memset(CmtData->Addr(0),0,CmtData->Size()*sizeof(wchar)); CharToWide((char *)UnpData,CmtData->Addr(0),UnpDataSize); CmtData->Alloc(wcslen(CmtData->Addr(0))); } } else { Array<byte> CmtRaw(CmtLength); Read(&CmtRaw[0],CmtLength); if (Format!=RARFMT14 && CommHead.CommCRC!=(~CRC32(0xffffffff,&CmtRaw[0],CmtLength)&0xffff)) { uiMsg(UIERROR_CMTBROKEN,FileName); return false; } CmtData->Alloc(CmtLength+1); CmtRaw.Push(0); #ifdef _WIN_ALL OemToCharA((char *)&CmtRaw[0],(char *)&CmtRaw[0]); #endif CharToWide((char *)&CmtRaw[0],CmtData->Addr(0),CmtLength); CmtData->Alloc(wcslen(CmtData->Addr(0))); } #endif return CmtData->Size() > 0; }