void FGeomObject::GetFromSource() { PolyPool.Empty(); EdgePool.Empty(); VertexPool.Empty(); for( int32 p = 0 ; p < GetActualBrush()->Brush->Polys->Element.Num() ; ++p ) { FPoly* poly = &(GetActualBrush()->Brush->Polys->Element[p]); new( PolyPool )FGeomPoly(); FGeomPoly* gp = &PolyPool[ PolyPool.Num()-1 ]; gp->SetParentObjectIndex( GetObjectIndex() ); gp->ActualPolyIndex = p; for( int32 v = 1 ; v <= poly->Vertices.Num() ; ++v ) { int32 idx = (v == poly->Vertices.Num()) ? 0 : v, previdx = v-1; int32 eidx = AddEdgeToPool( gp, PolyPool.Num()-1, previdx, idx ); gp->EdgeIndices.Add( eidx ); } } ComputeData(); }
//************************************************************************ void CNutDropScene::CheckObjectCollision (LPSPRITE lpSprite) //************************************************************************ { if (!m_lpPlayerSprite || !m_pAnimator) return; // See if they've picked enough already if (m_nGoodPicks >= m_nMatchesNeeded) return; static BOOL fBusy = FALSE; if (fBusy) return; fBusy = TRUE; RECT rBasket, rBasketX; rBasket = (m_WalkDir == WALKLEFT ? m_rLeftBasket : m_rRightBasket ); m_lpPlayerSprite->Location (&rBasketX); OffsetRect( &rBasket, rBasketX.left, rBasketX.top ); IntersectRect( &rBasket, &rBasket, &rBasketX ); if (m_pAnimator->CheckCollision (m_lpPlayerSprite, lpSprite, &rBasket)) { int idx = GetObjectIndex (lpSprite); if (idx == -1 || m_ObjectList[idx].m_nState == StateGoodPick) { fBusy = FALSE; return; } m_ObjectList[idx].m_nState = StateGoodPick; m_nGoodPicks++; // Play the got one sound if one is defined FNAME szFileName; GetPathName (szFileName, m_szGotOneWave); if (m_nGoodPicks < m_nMatchesNeeded) { if (GetSound() && m_szGotOneWave[0] != '\0') { GetSound()->StopChannel (NORMAL_CHANNEL); GetSound()->StartFile (szFileName, NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, FALSE); } } else PlaySound(szFileName, FALSE); // how to play with wait AND wavemix // Hide this object lpSprite->Show (FALSE); // Update the caught score UpdateSpriteScore (m_lpCaughtScore[0], m_lpCaughtScore[1], m_nGoodPicks); // See if they've picked enough to win this level if (m_nGoodPicks >= m_nMatchesNeeded) PlayLevelSuccessWave(); } fBusy = FALSE; }
UObject* FWeakObjectPtr::Get(bool bEvenIfPendingKill) const { UObject *Result = NULL; if (IsValid(true)) { Result = (UObject*)(GUObjectArray.IndexToObject(GetObjectIndex(), bEvenIfPendingKill)); } return Result; }
UObject* FWeakObjectPtr::GetEvenIfUnreachable() const { UObject* Result = nullptr; if (Internal_IsValid(true, true)) { FUObjectItem* ObjectItem = GUObjectArray.IndexToObject(GetObjectIndex(), true); Result = static_cast<UObject*>(ObjectItem->Object); } return Result; }
/** * Get the object associated with a tile. * @param tile The tile to fetch the object for. * @return The object. */ /* static */ Object *Object::GetByTile(TileIndex tile) { return Object::Get(GetObjectIndex(tile)); }