Exemplo n.º 1
0
// check if all of the corners of entity's bounding box are influenced by current select-on-render selection
void SelectEntityOnRender(CProjection3D &prProjection, CEntity &en)
{
  FLOATaabbox3D bbox;

  FLOATmatrix3D mOne = FLOATmatrix3D(0.0f);
  mOne.Diagonal(1.0f);
  FLOATmatrix3D *pmR;
  FLOAT3D vOffset;

  // if this entity is model
  if (en.en_RenderType==CEntity::RT_MODEL || en.en_RenderType==CEntity::RT_EDITORMODEL)
  {
    // get bbox of current frame
    CModelObject *pmo = en.GetModelObject();
    pmo->GetCurrentFrameBBox( bbox);
    pmR = &en.en_mRotation;
    vOffset = en.GetPlacement().pl_PositionVector;
  }
  // if it is ska model
  else if(en.en_RenderType==CEntity::RT_SKAMODEL || en.en_RenderType==CEntity::RT_SKAEDITORMODEL)
  {
    en.GetModelInstance()->GetCurrentColisionBox( bbox);
    pmR = &en.en_mRotation;
    vOffset = en.GetPlacement().pl_PositionVector;
  }
  // if it is brush
  else
  {
    // get bbox of brush's first mip
    CBrush3D *pbr = en.GetBrush();
    CBrushMip *pbrmip = pbr->GetFirstMip();
    bbox = pbrmip->bm_boxBoundingBox;
    pmR = &mOne;
    vOffset = FLOAT3D( 0.0f, 0.0f, 0.0f);
  }

  if( IsBoundingBoxInLasso( prProjection, bbox, pmR, vOffset))
  {
    if( _bSelectAlternative)
    {
      // deselect
      if (en.IsSelected(ENF_SELECTED))
      {
        _pselenSelectOnRender->Deselect(en);
      }
    }
    else
    {
      // select
      if (!en.IsSelected(ENF_SELECTED))
      {
        _pselenSelectOnRender->Select(en);
      }
    }
  }
}
Exemplo n.º 2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CUICreateChar::Reset()
{	
	Lock(FALSE);
	m_iSelectedJob	= 0;	
	m_fZDelta		= 0.0f;
	m_fRotDelta		= 0.0f;

	m_ebCharName.ResetString();

	// 카메라 설정, 캐릭터 위치 설정.	
	for(int i = 0; i < MAXJOB; ++i)
	{
		const int iMarker			= _aiMarkerEntities[i];
		CEntity *penMarker			= m_pWorld->EntityFromID(iMarker);	
		penMarker->SetSkaModel(JobInfo().GetFileName(i));
		g_CharacterAngle[i] = penMarker->GetPlacement().pl_OrientationAngle(1);
		
		CModelInstance* pMI	= penMarker->GetModelInstance();
		if(pMI)
		{		
			INDEX idAttackIdle = ska_GetIDFromStringTable( JobInfo().GetAnimationName( i, ANIM_IDLE ) );
			pMI->AddAnimation(idAttackIdle, AN_LOOPING|AN_NORESTART|AN_CLEAR, 1, 0);
		}
	}
	
#if defined(G_BRAZIL) 
		CharWearing();
#endif
	ChangeSelJob();

	m_bIsShowMessageInfo = _pGameState->IsCreatableNightShadow();
}
Exemplo n.º 3
0
void CDlgPgPosition::DoDataExchange(CDataExchange* pDX)
{
  if( theApp.m_bDisableDataExchange) return;

  CPropertyPage::DoDataExchange(pDX);

  SetModified( TRUE);

  // obtain document
  CWorldEditorDoc* pDoc = theApp.GetDocument();
  // if document doesn't exist, return
  if( pDoc == NULL)  return;
  // get active view 
  CWorldEditorView *pWorldEditorView = theApp.GetActiveView();

  // if dialog is recieving data
  if( pDX->m_bSaveAndValidate == FALSE)
  {
	  // is CSG on?
    if( pDoc->m_pwoSecondLayer != NULL)
    {
      // yes, pick up coordinates for editting from second layer
      m_fHeading = DegAngle( pDoc->m_plSecondLayer.pl_OrientationAngle(1));
	    m_fPitch   = DegAngle( pDoc->m_plSecondLayer.pl_OrientationAngle(2));
	    m_fBanking = DegAngle( pDoc->m_plSecondLayer.pl_OrientationAngle(3));

      m_fX = pDoc->m_plSecondLayer.pl_PositionVector(1);
      m_fY = pDoc->m_plSecondLayer.pl_PositionVector(2);
      m_fZ = pDoc->m_plSecondLayer.pl_PositionVector(3);
    }
    // otherwise if we are in entity mode and there is only one entity selected
    else if( (pDoc->m_iMode == ENTITY_MODE) && ( pDoc->m_selEntitySelection.Count() == 1) )
    {
      // lock selection's dynamic container
      pDoc->m_selEntitySelection.Lock();
      // get first entity
      CEntity *penEntityOne = pDoc->m_selEntitySelection.Pointer(0);
      // unlock selection's dynamic container
      pDoc->m_selEntitySelection.Unlock();

      // get placement of first entity
      CPlacement3D plEntityOnePlacement = penEntityOne->GetPlacement();
      m_fHeading = DegAngle( plEntityOnePlacement.pl_OrientationAngle(1));
	    m_fPitch   = DegAngle( plEntityOnePlacement.pl_OrientationAngle(2));
	    m_fBanking = DegAngle( plEntityOnePlacement.pl_OrientationAngle(3));

      m_fX = plEntityOnePlacement.pl_PositionVector(1);
      m_fY = plEntityOnePlacement.pl_PositionVector(2);
      m_fZ = plEntityOnePlacement.pl_PositionVector(3);
    }
    m_udSelection.MarkUpdated();
  }

	//{{AFX_DATA_MAP(CDlgPgPosition)
	DDX_Text(pDX, IDC_EDIT_BANKING, m_fBanking);
	DDX_Text(pDX, IDC_EDIT_HEADING, m_fHeading);
	DDX_Text(pDX, IDC_EDIT_PITCH, m_fPitch);
	DDX_Text(pDX, IDC_EDIT_X, m_fX);
	DDX_Text(pDX, IDC_EDIT_Y, m_fY);
	DDX_Text(pDX, IDC_EDIT_Z, m_fZ);
	//}}AFX_DATA_MAP

  // if dialog is giving data
  if( pDX->m_bSaveAndValidate != FALSE)
  {
	  // is CSG on?
    if( pDoc->m_pwoSecondLayer != NULL)
    {
      // yes, copy coordinates from editting controls into second layer
      pDoc->m_plSecondLayer.pl_OrientationAngle(1) = AngleDeg( m_fHeading);
	    pDoc->m_plSecondLayer.pl_OrientationAngle(2) = AngleDeg( m_fPitch);
	    pDoc->m_plSecondLayer.pl_OrientationAngle(3) = AngleDeg( m_fBanking);
      pDoc->m_plSecondLayer.pl_PositionVector(1) = m_fX;
      pDoc->m_plSecondLayer.pl_PositionVector(2) = m_fY;
      pDoc->m_plSecondLayer.pl_PositionVector(3) = m_fZ;

      // snap values to grid
      pDoc->SnapToGrid( pDoc->m_plSecondLayer, SNAP_FLOAT_12);
      theApp.m_vfpCurrent.vfp_plPrimitive = pDoc->m_plSecondLayer;

      // update all document's views
      pDoc->UpdateAllViews( NULL);
    }
    // otherwise if we are in entity mode
    else if( pDoc->m_iMode == ENTITY_MODE)
    {
      // there must be only one entity selected
      ASSERT( pDoc->m_selEntitySelection.Count() == 1);
      
      // lock selection's dynamic container
      pDoc->m_selEntitySelection.Lock();
      // get first entity
      CEntity *penEntityOne = pDoc->m_selEntitySelection.Pointer(0);
      // unlock selection's dynamic container
      pDoc->m_selEntitySelection.Unlock();

      // get placement of first entity
      CPlacement3D plEntityOnePlacement = penEntityOne->GetPlacement();
      plEntityOnePlacement.pl_OrientationAngle(1) = AngleDeg( m_fHeading);
	    plEntityOnePlacement.pl_OrientationAngle(2) = AngleDeg( m_fPitch);
	    plEntityOnePlacement.pl_OrientationAngle(3) = AngleDeg( m_fBanking);

      plEntityOnePlacement.pl_PositionVector(1) = m_fX;
      plEntityOnePlacement.pl_PositionVector(2) = m_fY;
      plEntityOnePlacement.pl_PositionVector(3) = m_fZ;

      // snap entity's placement
      pDoc->SnapToGrid( plEntityOnePlacement, SNAP_FLOAT_12);
      
      // set placement back to entity
      penEntityOne->SetPlacement( plEntityOnePlacement);

      pDoc->SetModifiedFlag( TRUE);
      pDoc->UpdateAllViews( NULL);
      m_udSelection.MarkUpdated();

      // update all document's views
      pDoc->UpdateAllViews( NULL);
    }
  }
}