void wxControl::MacAdjustControlRect() { wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; if ( m_width == -1 || m_height == -1 ) { Rect bestsize = { 0 , 0 , 0 , 0 } ; short baselineoffset ; ::GetBestControlRect( (ControlHandle) m_macControl , &bestsize , &baselineoffset ) ; if ( EmptyRect( &bestsize ) ) { baselineoffset = 0; bestsize.left = bestsize.top = 0 ; bestsize.right = 16 ; bestsize.bottom = 16 ; if ( IsKindOf( CLASSINFO( wxScrollBar ) ) ) { bestsize.bottom = 16 ; } else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) ) { bestsize.bottom = 24 ; } } if ( m_width == -1 ) { if ( IsKindOf( CLASSINFO( wxButton ) ) ) { m_width = m_label.Length() * 8 + 12 ; if ( m_width < 70 ) m_width = 70 ; } else if ( IsKindOf( CLASSINFO( wxStaticText ) ) ) { m_width = m_label.Length() * 8 ; } else m_width = bestsize.right - bestsize.left ; m_width += 2 * m_macHorizontalBorder + MacGetLeftBorderSize() + MacGetRightBorderSize() ; } if ( m_height == -1 ) { m_height = bestsize.bottom - bestsize.top ; if ( m_height < 10 ) m_height = 13 ; m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ; } MacUpdateDimensions() ; } }
void AI_Helicopter::InitAttachments() { CAIVehicle::InitAttachments(); for ( int iObject = 0 ; iObject < m_cObjects ; iObject++ ) { BaseClass* pObject = m_apObjects[iObject]; if (pObject) { if ( IsKindOf(pObject->m_hObject, "ControlledSearchLight") ) { m_iObjectSearchLight = iObject; ControlledSearchLight* pSearchLight = ((ControlledSearchLight*)pObject); pSearchLight->SetController(m_hObject); HATTACHMENT hAttachment; if ( LT_OK == g_pLTServer->FindAttachment(m_hObject, pSearchLight->m_hObject, &hAttachment) ) { LTransform transform; g_pLTServer->Common()->GetAttachmentTransform(hAttachment, transform, LTTRUE); g_pTransLT->Get(transform, m_vPosSearchlight, m_rRotSearchlight); } } else if ( IsKindOf(pObject->m_hObject, "CAI") ) { Link(pObject->m_hObject); m_iObjectGunner = iObject; CAI* pGunner = ((CAI*)pObject); HATTACHMENT hAttachment; if ( LT_OK == g_pLTServer->FindAttachment(m_hObject, pGunner->m_hObject, &hAttachment) ) { LTransform transform; g_pLTServer->Common()->GetAttachmentTransform(hAttachment, transform, LTTRUE); g_pTransLT->Get(transform, m_vPosGunner, m_rRotGunner); } char szMessage[128]; sprintf(szMessage, "HELIATTACK HELI=%s", g_pLTServer->GetObjectName(m_hObject)); SendTriggerMsgToObject(this, pGunner->GetObject(), LTFALSE, szMessage); } } } }
/// Gets the style combined with the base style wxRichTextAttr wxRichTextStyleDefinition::GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const { if (m_baseStyle.IsEmpty()) return m_style; bool isParaStyle = IsKindOf(wxCLASSINFO(wxRichTextParagraphStyleDefinition)); bool isCharStyle = IsKindOf(wxCLASSINFO(wxRichTextCharacterStyleDefinition)); bool isListStyle = IsKindOf(wxCLASSINFO(wxRichTextListStyleDefinition)); bool isBoxStyle = IsKindOf(wxCLASSINFO(wxRichTextBoxStyleDefinition)); // Collect the styles, detecting loops wxArrayString styleNames; wxList styles; const wxRichTextStyleDefinition* def = this; while (def) { styles.Insert((wxObject*) def); styleNames.Add(def->GetName()); wxString baseStyleName = def->GetBaseStyle(); if (!baseStyleName.IsEmpty() && styleNames.Index(baseStyleName) == wxNOT_FOUND) { if (isParaStyle) def = sheet->FindParagraphStyle(baseStyleName); else if (isCharStyle) def = sheet->FindCharacterStyle(baseStyleName); else if (isListStyle) def = sheet->FindListStyle(baseStyleName); else if (isBoxStyle) def = sheet->FindBoxStyle(baseStyleName); else def = sheet->FindStyle(baseStyleName); } else def = NULL; } wxRichTextAttr attr; wxList::compatibility_iterator node = styles.GetFirst(); while (node) { wxRichTextStyleDefinition* def = (wxRichTextStyleDefinition*) node->GetData(); attr.Apply(def->GetStyle(), NULL); node = node->GetNext(); } return attr; }
void wxControl::DoSetWindowVariant( wxWindowVariant variant ) { if ( m_macControl == NULL ) { wxWindow::SetWindowVariant( variant ) ; return ; } m_windowVariant = variant ; ControlSize size ; ControlFontStyleRec fontStyle; fontStyle.flags = kControlUseFontMask ; // we will get that from the settings later // and make this NORMAL later, but first // we have a few calculations that we must fix if ( variant == wxWINDOW_VARIANT_NORMAL ) { if ( IsKindOf( CLASSINFO( wxScrollBar ) ) ) variant = wxWINDOW_VARIANT_NORMAL ; else variant = wxWINDOW_VARIANT_SMALL ; } switch ( variant ) { case wxWINDOW_VARIANT_NORMAL : size = kControlSizeNormal; fontStyle.font = kControlFontBigSystemFont; break ; case wxWINDOW_VARIANT_SMALL : size = kControlSizeSmall; fontStyle.font = kControlFontSmallSystemFont; break ; case wxWINDOW_VARIANT_MINI : if (UMAGetSystemVersion() >= 0x1030 ) { size = 3 ; // not always defined in the header fontStyle.font = -5 ; // not always defined in the header } else { size = kControlSizeSmall; fontStyle.font = kControlFontSmallSystemFont; } break; break ; case wxWINDOW_VARIANT_LARGE : size = kControlSizeLarge; fontStyle.font = kControlFontBigSystemFont; break ; default: wxFAIL_MSG(_T("unexpected window variant")); break ; } ::SetControlData( (ControlHandle) m_macControl , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size ); ::SetControlFontStyle( (ControlHandle) m_macControl , &fontStyle ); }
// Scroll to the given line (in scroll units where each unit is // the height of an item) void wxRemotelyScrolledTreeCtrl::ScrollToLine(int posHoriz, int posVert) { #ifdef __WXMSW__ if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { UINT sbCode = SB_THUMBPOSITION; HWND vertScrollBar = 0; MSWDefWindowProc((WXUINT) WM_VSCROLL, MAKELONG(sbCode, posVert), (WXHWND) vertScrollBar); } else #endif { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; win->Refresh(); /* Doesn't work yet because scrolling is ignored by Scroll int xppu, yppu; wxScrolledWindow* scrolledWindow = GetScrolledWindow(); if (scrolledWindow) { scrolledWindow->GetScrollPixelsPerUnit(& xppu, & yppu); win->Scroll(-1, posVert*yppu); } */ } }
// Number of pixels per user unit (0 or -1 for no scrollbar) // Length of virtual canvas in user units // Length of page in user units void wxRemotelyScrolledTreeCtrl::SetScrollbars( #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos, int yPos, bool noRefresh #else int WXUNUSED(pixelsPerUnitX), int WXUNUSED(pixelsPerUnitY), int WXUNUSED(noUnitsX), int WXUNUSED(noUnitsY), int WXUNUSED(xPos), int WXUNUSED(yPos), bool WXUNUSED(noRefresh) #endif ) { #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ true); wxScrolledWindow* scrolledWindow = GetScrolledWindow(); if (scrolledWindow) { scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh); } } #endif }
void CAIActionReactToDanger::ApplyContextEffect( CAI* pAI, CAIWorldState* pwsWorldStateCur, CAIWorldState* pwsWorldStateGoal ) { // Sanity check. if( !( pAI && pwsWorldStateCur && pwsWorldStateGoal ) ) { return; } // Actually apply the planner effects, which is not the // default behavior of an Action running in context. // Only clear the disturbance world state if AI was reacting to a grenade or AINode. CAIWMFact factQuery; factQuery.SetFactType( kFact_Danger ); CAIWMFact* pFact = pAI->GetAIWorkingMemory()->FindWMFact( factQuery ); if( !pFact ) { return; } if( IsAINode( pFact->GetSourceObject() ) || IsKindOf( pFact->GetSourceObject(), "CProjectile" ) ) { ApplyWSEffect( pAI, pwsWorldStateCur, pwsWorldStateGoal ); } }
// In case we're using the generic tree control. int wxRemotelyScrolledTreeCtrl::GetScrollPos( #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) int orient #else int WXUNUSED(orient) #endif ) const { #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) // this condition fixes extsitence of warning but wxScrolledWindow* scrolledWindow = // but GetScrolledWindow is still executed in case internally does something #endif GetScrolledWindow(); #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; if (orient == wxHORIZONTAL) return win->wxGenericTreeCtrl::GetScrollPos(orient); else { return scrolledWindow->GetScrollPos(orient); } } #endif return 0; }
// In case we're using the generic tree control. // Get the view start void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const { wxScrolledWindow* scrolledWindow = GetScrolledWindow(); #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; int x1, y1, x2, y2; win->wxGenericTreeCtrl::GetViewStart(& x1, & y1); * x = x1; * y = y1; if (!scrolledWindow) return; scrolledWindow->GetViewStart(& x2, & y2); * y = y2; } else #endif { // x is wrong since the horizontal scrollbar is controlled by the // tree control, but we probably don't need it. scrolledWindow->GetViewStart(x, y); } }
static AINodeSurprise* GetSurpriseNode( CAIWorldState& rWorldState, HOBJECT hObject ) { // Fail if the AI is not at a node of type Surprise. SAIWORLDSTATE_PROP* pAtNodeTypeProp = rWorldState.GetWSProp( kWSK_AtNodeType, hObject ); if ( !pAtNodeTypeProp || ( kNode_Surprise != pAtNodeTypeProp->eAINodeTypeWSValue ) ) { return NULL; } // Fail if we cannot get a pointer to the node. SAIWORLDSTATE_PROP* pAtNodeProp = rWorldState.GetWSProp( kWSK_AtNode, hObject ); if ( !pAtNodeProp || ( !pAtNodeProp->hWSValue ) ) { return NULL; } // Type should always be correct as we check AtNodeType earlier. Planner // should keep these in sync. AIASSERT( IsKindOf( pAtNodeProp->hWSValue, "AINodeSurprise" ), pAtNodeProp->hWSValue, "CAIGoalSurpriseAttackLaunch::CalculateGoalRelevance: Object is not an AINodeSurprise instance. Verify the node type matches expectations." ); AINodeSurprise* pSurprise = (AINodeSurprise*)g_pLTServer->HandleToObject( pAtNodeProp->hWSValue ); if ( !pSurprise ) { return NULL; } return pSurprise; }
void WorldModel::DetachObject( HOBJECT hObj ) { if( !hObj ) return; // Remove the object from our list of attachments. Should only be in here once. for( ObjRefNotifierList::iterator iter = m_AttachmentList.begin( ); iter != m_AttachmentList.end( ); iter++ ) { if( hObj == *iter ) { // Remove it from our list. m_AttachmentList.erase( iter ); break; } } HATTACHMENT hAttachment = NULL; if( g_pLTServer->FindAttachment( m_hObject, hObj, &hAttachment ) != LT_OK ) return; g_pLTServer->RemoveAttachment( hAttachment ); // If the object is a WorldModel set it's activate parent... if( IsWorldModel( hObj )) { WorldModel *pWorldModel = dynamic_cast<WorldModel*>(g_pLTServer->HandleToObject( hObj )); if( pWorldModel ) { // No longer send any activate messages the WorldModel recevies to us... pWorldModel->SetActivateParent( LTNULL ); // Remove the WorldModel from our list of object to inherit our ActivateType... m_ActivateTypeHandler.DisownObject( hObj ); } } // Don't just let the object float uint32 dwFlags; g_pCommonLT->GetObjectFlags( hObj, OFT_Flags, dwFlags ); if( (IsKindOf(hObj, "Prop" )) && (dwFlags & FLAG_GRAVITY) ) { LTVector vVel; g_pPhysicsLT->GetVelocity( hObj, &vVel ); if( vVel.y > -0.1f ) { vVel.y -= 10.0f; g_pPhysicsLT->SetVelocity( hObj, &vVel ); } } }
void CScrolledTreeCtrl::HideVScrollbar() { #ifdef __WXMSW__ if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxLogVerbose(wxT("-+-+- CScrolledTreeCtrl::HideVScrollbar")); ::ShowScrollBar((HWND) GetHWND(), SB_VERT, false); } #endif }
DPSprite::DPSprite(player_t *owner, AActor *caller, int id) : x(.0), y(.0), oldx(.0), oldy(.0), firstTic(true), Tics(0), Flags(0), Caller(caller), Owner(owner), State(nullptr), Sprite(0), Frame(0), ID(id), processPending(true) { alpha = 1; Renderstyle = STYLE_Normal; DPSprite *prev = nullptr; DPSprite *next = Owner->psprites; while (next != nullptr && next->ID < ID) { prev = next; next = next->Next; } Next = next; GC::WriteBarrier(this, next); if (prev == nullptr) { Owner->psprites = this; GC::WriteBarrier(this); } else { prev->Next = this; GC::WriteBarrier(prev, this); } if (Next && Next->ID == ID && ID != 0) Next->Destroy(); // Replace it. if (Caller->IsKindOf(NAME_Weapon) || Caller->IsKindOf(NAME_PlayerPawn)) Flags = (PSPF_ADDWEAPON|PSPF_ADDBOB|PSPF_POWDOUBLE|PSPF_CVARFAST); }
void CAIHelicopterStateAttack::HandleNameValuePair(char *szName, char *szValue) { CAIHelicopterState::HandleNameValuePair(szName, szValue); if ( !_stricmp(szName, "FIRE") ) { if ( !_stricmp(szValue, "FULL") ) { m_pStrategyShoot->SetFire(CAnimatorAIVehicle::eFireFull); } else if ( !_stricmp(szValue, "FIRE1") ) { m_pStrategyShoot->SetFire(CAnimatorAIVehicle::eFire1); } else if ( !_stricmp(szValue, "FIRE2") ) { m_pStrategyShoot->SetFire(CAnimatorAIVehicle::eFire2); } else if ( !_stricmp(szValue, "FIRE3") ) { m_pStrategyShoot->SetFire(CAnimatorAIVehicle::eFire3); } else if ( !_stricmp(szValue, "FIRE4") ) { m_pStrategyShoot->SetFire(CAnimatorAIVehicle::eFire4); } else { g_pLTServer->CPrint("CAIHelicopterStateAttack - FIRE=%s is not a valid fire type", szValue); } } else if ( !_stricmp(szName, "TARGET") ) { GetAI()->Unlink(m_hTarget); m_hTarget = LTNULL; if ( LT_OK == FindNamedObject(szValue, m_hTarget) ) { if ( IsKindOf(m_hTarget, "CCharacter") ) { GetAI()->Link(m_hTarget); } else { g_pLTServer->CPrint("ATTACK TARGET=%s -- this object is not a CCharacter!", szValue); m_hTarget = LTNULL; } } else { g_pLTServer->CPrint("ATTACK TARGET=%s -- this object does not exist!", szName); } } }
wxSize wxControl::DoGetBestSize() const { if ( (ControlHandle) m_macControl == NULL ) return wxWindow::DoGetBestSize() ; Rect bestsize = { 0 , 0 , 0 , 0 } ; short baselineoffset ; int bestWidth, bestHeight ; ::GetBestControlRect( (ControlHandle) m_macControl , &bestsize , &baselineoffset ) ; if ( EmptyRect( &bestsize ) ) { baselineoffset = 0; bestsize.left = bestsize.top = 0 ; bestsize.right = 16 ; bestsize.bottom = 16 ; if ( IsKindOf( CLASSINFO( wxScrollBar ) ) ) { bestsize.bottom = 16 ; } else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) ) { bestsize.bottom = 24 ; } } bestWidth = bestsize.right - bestsize.left ; bestWidth += 2 * m_macHorizontalBorder ; bestHeight = bestsize.bottom - bestsize.top ; if ( bestHeight < 10 ) bestHeight = 13 ; bestHeight += 2 * m_macVerticalBorder; return wxSize(bestWidth, bestHeight); }
void wxRemotelyScrolledTreeCtrl::HideVScrollbar() { #ifdef __WXMSW__ if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { ::ShowScrollBar((HWND) GetHWND(), SB_VERT, FALSE); } else #endif { // Implicit in overriding SetScrollbars } }
// Adjust the containing wxScrolledWindow's scrollbars appropriately void wxRemotelyScrolledTreeCtrl::AdjustRemoteScrollbars() { #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { // This is for the generic tree control. // It calls SetScrollbars which has been overridden // to adjust the parent scrolled window vertical // scrollbar. ((wxGenericTreeCtrl*) this)->AdjustMyScrollbars(); return; } else #endif { // This is for the wxMSW tree control wxScrolledWindow* scrolledWindow = GetScrolledWindow(); if (scrolledWindow) { wxRect itemRect; if (GetBoundingRect(GetRootItem(), itemRect)) { // Actually, the real height seems to be 1 less than reported // (e.g. 16 instead of 16) int itemHeight = itemRect.GetHeight() - 1; int w, h; GetClientSize(&w, &h); wxRect rect(0, 0, 0, 0); CalcTreeSize(rect); double f = ((double) (rect.GetHeight()) / (double) itemHeight) ; int treeViewHeight = (int) ceil(f); int scrollPixelsPerLine = itemHeight; int scrollPos = - (itemRect.y / itemHeight); scrolledWindow->SetScrollbars(0, scrollPixelsPerLine, 0, treeViewHeight, 0, scrollPos); // Ensure that when a scrollbar becomes hidden or visible, // the contained window sizes are right. // Problem: this is called too early (?) wxSizeEvent event(scrolledWindow->GetSize(), scrolledWindow->GetId()); scrolledWindow->GetEventHandler()->ProcessEvent(event); } } } }
void Camera::HandleMoveToMsg( HOBJECT hSender, const CParsedMsg &crParsedMsg ) { HOBJECT hObject; if( LT_OK == FindNamedObject( crParsedMsg.GetArg(1), hObject )) { if( !IsKindOf( hObject, "CameraPoint" )) return; // Just place the camera at the Point's position and rotation... LTRigidTransform tTrans; g_pLTServer->GetObjectTransform(hObject, &tTrans); g_pLTServer->SetObjectTransform(m_hObject, tTrans); } }
void wxRemotelyScrolledTreeCtrl::HideVScrollbar() { #if defined(__WXMSW__) #if USE_GENERIC_TREECTRL if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) #endif { ::ShowScrollBar((HWND) GetHWND(), SB_VERT, false); } #if USE_GENERIC_TREECTRL else { // Implicit in overriding SetScrollbars } #endif #endif }
// In case we're using the generic tree control. int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const { ecScrolledWindow* scrolledWindow = GetScrolledWindow(); if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; if (orient == wxHORIZONTAL) return win->wxGenericTreeCtrl::GetScrollPos(orient); else { return scrolledWindow->GetScrollPos(orient); } } return 0; }
int CScrolledTreeCtrl::GetScrollPos(int orient) const { #if !defined(__WXMSW__) wxScrolledWindow *scrolledWindow = GetScrolledWindow(); if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl *win = (wxGenericTreeCtrl *) this; if (orient == wxHORIZONTAL) { return win->wxGenericTreeCtrl::GetScrollPos(orient); } else { return scrolledWindow->GetScrollPos(orient); } } #endif return 0; }
bool SoundNonPoint::AllObjectsCreated() { // resolve the object links. Basically, get the sound zone volumes // and collect their info into the non-point sound object that // gets created on the client. ObjArray <HOBJECT, 1> objArray; int32 i; m_SCS.m_nNumZones = 0; for (i=0; i < MAX_SOUND_VOLUMES; i++) { SoundZoneVolume* pSZV; if(!LTStrEmpty(m_sSoundZone[i].c_str())) { g_pLTServer->FindNamedObjects(m_sSoundZone[i].c_str(), objArray); if(objArray.NumObjects() > 0) { if (IsKindOf(objArray.GetObject(0), "SoundZoneVolume")) { HOBJECT hObj; hObj = objArray.GetObject(0); pSZV = (SoundZoneVolume*) g_pLTServer->HandleToObject(hObj); // do a type check before casting... if (pSZV) { g_pLTServer->GetObjectPos(hObj, &m_SCS.m_SoundZone[m_SCS.m_nNumZones].m_vPos); g_pLTServer->GetObjectRotation(hObj, &m_SCS.m_SoundZone[m_SCS.m_nNumZones].m_rRotation); m_SCS.m_SoundZone[m_SCS.m_nNumZones].m_vHalfDims = pSZV->GetHalfDims(); m_SCS.m_nNumZones++; } } } } } return true; }
// In case we're using the generic tree control. int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const { wxScrolledWindow* scrolledWindow = GetScrolledWindow(); #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; if (orient == wxHORIZONTAL) return win->wxGenericTreeCtrl::GetScrollPos(orient); else { return scrolledWindow->GetScrollPos(orient); } } #endif return 0; }
// In case we're using the generic tree control. void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc) { if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { ecScrolledWindow* scrolledWindow = GetScrolledWindow(); wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; int startX, startY; GetViewStart(& startX, & startY); int xppu1, yppu1, xppu2, yppu2; win->wxGenericTreeCtrl::GetScrollPixelsPerUnit(& xppu1, & yppu1); scrolledWindow->GetScrollPixelsPerUnit(& xppu2, & yppu2); dc.SetDeviceOrigin( -startX * xppu1, -startY * yppu2 ); // dc.SetUserScale( win->GetScaleX(), win->GetScaleY() ); } }
void CScrolledTreeCtrl::PrepareDC(wxDC & dc) { #if !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxTreeCtrl))) { wxScrolledWindow *scrolledWindow = GetScrolledWindow(); wxGenericTreeCtrl *win = (wxGenericTreeCtrl *) this; int startX, startY; GetViewStart(&startX, &startY); int xppu1, yppu1, xppu2, yppu2; win->wxGenericTreeCtrl::GetScrollPixelsPerUnit(&xppu1, &yppu1); scrolledWindow->GetScrollPixelsPerUnit(&xppu2, &yppu2); dc.SetDeviceOrigin(-startX * xppu1, -startY * yppu2); } #endif }
void CScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos, int yPos, bool noRefresh) { #if !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl *win = (wxGenericTreeCtrl *) this; // Pass TRUE for noRefresh so that it doesn't // draw part of the tree as if the scroll view is // at zero vertically. win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ true); wxScrolledWindow *scrolledWindow = GetScrolledWindow(); if (scrolledWindow) { wxLogVerbose(wxT(" - > CScrolledTreeCtrl::SetScrollbars")); scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh); } } #endif }
// Number of pixels per user unit (0 or -1 for no scrollbar) // Length of virtual canvas in user units // Length of page in user units void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos, int yPos, bool noRefresh) { if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; // Pass TRUE for noRefresh so that it doesn't // draw part of the tree as if the scroll view is // at zero vertically. win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ TRUE); ecScrolledWindow* scrolledWindow = GetScrolledWindow(); if (scrolledWindow) { scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh); } } }
// Helper function to return the AIDB_SmartObjectRecord record of the // AINodeSmartObject instance the AI is at in the passted in worldspace. // Returns NULL if the AI is not at a node, the node is not a SmartObject, // or the SmartObject doesn't have a AIDB_SmartObjectRecord. static const AIDB_SmartObjectRecord* GetAtNodeSmartObjectRecord( CAIWorldState& rWorldState, HOBJECT hObject ) { SAIWORLDSTATE_PROP* pProp = rWorldState.GetWSProp( kWSK_AtNode, hObject ); if ( !pProp || !pProp->hWSValue ) { return NULL; } if ( !IsKindOf( pProp->hWSValue, "AINodeSmartObject" ) ) { return NULL; } AINodeSmartObject* pSmartObjectNode = (AINodeSmartObject*)g_pLTServer->HandleToObject( pProp->hWSValue ); if ( !pSmartObjectNode ) { return NULL; } return pSmartObjectNode->GetSmartObject(); }
void DPSprite::SetState(FState *newstate, bool pending) { if (ID == PSP_WEAPON) { // A_WeaponReady will re-set these as needed Owner->WeaponState &= ~(WF_WEAPONREADY | WF_WEAPONREADYALT | WF_WEAPONBOBBING | WF_WEAPONSWITCHOK | WF_WEAPONRELOADOK | WF_WEAPONZOOMOK | WF_USER1OK | WF_USER2OK | WF_USER3OK | WF_USER4OK); } processPending = pending; do { if (newstate == nullptr) { // Object removed itself. Destroy(); return; } if (!(newstate->UseFlags & (SUF_OVERLAY|SUF_WEAPON))) // Weapon and overlay are mostly the same, the main difference is that weapon states restrict the self pointer to class Actor. { Printf(TEXTCOLOR_RED "State %s not flagged for use in overlays or weapons\n", FState::StaticGetStateName(newstate).GetChars()); State = nullptr; Destroy(); return; } else if (!(newstate->UseFlags & SUF_WEAPON)) { if (Caller->IsKindOf(NAME_Weapon)) { Printf(TEXTCOLOR_RED "State %s not flagged for use in weapons\n", FState::StaticGetStateName(newstate).GetChars()); State = nullptr; Destroy(); return; } } State = newstate; if (newstate->sprite != SPR_FIXED) { // okay to change sprite and/or frame if (!newstate->GetSameFrame()) { // okay to change frame Frame = newstate->GetFrame(); } if (newstate->sprite != SPR_NOCHANGE) { // okay to change sprite Sprite = newstate->sprite; } } Tics = newstate->GetTics(); // could be 0 if (Flags & PSPF_CVARFAST) { if (sv_fastweapons == 2 && ID == PSP_WEAPON) Tics = newstate->ActionFunc == nullptr ? 0 : 1; else if (sv_fastweapons == 3) Tics = (newstate->GetTics() != 0); else if (sv_fastweapons) Tics = 1; // great for producing decals :) } if (ID != PSP_FLASH) { // It's still possible to set the flash layer's offsets with the action function. // Anything going through here cannot be reliably interpolated so this has to reset the interpolation coordinates if it changes the values. if (newstate->GetMisc1()) { // Set coordinates. oldx = x = newstate->GetMisc1(); } if (newstate->GetMisc2()) { oldy = y = newstate->GetMisc2(); } } if (Owner->mo != nullptr) { FState *nextstate; FStateParamInfo stp = { newstate, STATE_Psprite, ID }; if (newstate->ActionFunc != nullptr && newstate->ActionFunc->Unsafe) { // If an unsafe function (i.e. one that accesses user variables) is being detected, print a warning once and remove the bogus function. We may not call it because that would inevitably crash. Printf(TEXTCOLOR_RED "Unsafe state call in state %sd to %s which accesses user variables. The action function has been removed from this state\n", FState::StaticGetStateName(newstate).GetChars(), newstate->ActionFunc->PrintableName.GetChars()); newstate->ActionFunc = nullptr; } if (newstate->CallAction(Owner->mo, Caller, &stp, &nextstate)) { // It's possible this call resulted in this very layer being replaced. if (ObjectFlags & OF_EuthanizeMe) { return; } if (nextstate != nullptr) { newstate = nextstate; Tics = 0; continue; } if (State == nullptr) { Destroy(); return; } } } newstate = State->GetNextState(); } while (!Tics); // An initial state of 0 could cycle through. return; }
LTBOOL DoVectorFilterFn(HOBJECT hObj, void *pUserData) { // We're not attacking our self... if (SpecificObjectFilterFn(hObj, pUserData)) { // CharacterHitBox objects are used for vector impacts, don't // impact on the character/body prop object itself.... if (IsCharacter(hObj) || IsBody(hObj) || IsKindOf(hObj, "Intelligence")) { return LTFALSE; } // Check special character hit box cases... if (IsCharacterHitBox(hObj)) { CCharacterHitBox *pCharHitBox = (CCharacterHitBox*) g_pLTServer->HandleToObject(hObj); if (pCharHitBox) { // Make sure we don't hit ourself... HOBJECT hUs = (HOBJECT)pUserData; HOBJECT hTestObj = pCharHitBox->GetModelObject(); if (!hTestObj) return LTFALSE; if (hTestObj == hUs) { return LTFALSE; } // Do special AI hitting AI case... if (IsAI(hUs) && IsAI(hTestObj)) { CAI *pAI = (CAI*) g_pLTServer->HandleToObject(hUs); if (!pAI) return LTFALSE; // We can't hit guys we like, unless they're NEUTRAL CCharacter* pB = (CCharacter*)g_pLTServer->HandleToObject(hTestObj); if (!pB) return LTFALSE; CharacterClass cc = pB->GetCharacterClass(); if (cc != NEUTRAL) { return LIKE != GetAlignement(pAI->GetCharacterClass(), cc); } } // Check for friendly fire if (g_pGameServerShell->GetGameType() == COOPERATIVE_ASSAULT && g_vtNetFriendlyFire.GetFloat() < 1.0f) { // We can't hit guys on our team unless friendly fire is turned on if (IsPlayer(hUs) && IsPlayer(hTestObj)) { CPlayerObj* pUs = (CPlayerObj*) g_pLTServer->HandleToObject(hUs); if (!pUs) return LTFALSE; CPlayerObj* pThem = (CPlayerObj*) g_pLTServer->HandleToObject(hTestObj); if (!pThem) return LTFALSE; if (pUs->GetTeamID() == pThem->GetTeamID()) return LTFALSE; } } } } return LTTRUE; } return LTFALSE; }