Exemple #1
0
//-----------------------------------------------------------------------------
// implements these so ragdolls can handle frustum culling & leaf visibility
//-----------------------------------------------------------------------------
void C_DynamicProp::GetRenderBounds( Vector& theMins, Vector& theMaxs )
{
	if ( m_bUseHitboxesForRenderBox )
	{
		if ( GetModel() )
		{
			studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel( GetModel() );
			if ( !pStudioHdr || GetSequence() == -1 )
			{
				theMins = vec3_origin;
				theMaxs = vec3_origin;
				return;
			}

			// Only recompute if it's a new frame
			if ( gpGlobals->framecount != m_iCachedFrameCount )
			{
				ComputeEntitySpaceHitboxSurroundingBox( &m_vecCachedRenderMins, &m_vecCachedRenderMaxs );
				m_iCachedFrameCount = gpGlobals->framecount;
			}

			theMins = m_vecCachedRenderMins;
			theMaxs = m_vecCachedRenderMaxs;
			return;
		}
	}

	BaseClass::GetRenderBounds( theMins, theMaxs );
}
Exemple #2
0
void setup1_qm::UpdateAtomFlags(void)
{
	for (iter_al it1 = GetModel()->GetAtomsBegin();it1 != GetModel()->GetAtomsEnd();it1++)
	{
		(* it1).flags |= ATOMFLAG_IS_QM_ATOM;
	}
}
void CSamplingInfEngine::
FindEnvironment( intVecVector *chlds )
{
    
    
    const CGraph *pGraph = m_pGraphicalModel->GetGraph();
    int i;
    if( GetModel()->GetModelType() != mtBNet )
    {
        int nnodes; 
        nnodes = GetModel()->GetNumberOfNodes();
        chlds->resize( nnodes );
        const CMNet* pMNet = static_cast<const CMNet*>( m_pGraphicalModel );
        
        for( i = 0; i < nnodes; i++ )
        {
            
            pMNet->GetClqsNumsForNode( i, &(*chlds)[i] );
        }
    }
    else
    {
        intVector ndsForSampling;
        GetNdsForSampling( &ndsForSampling );
        chlds->resize( ndsForSampling.size() );
        
        for( i = 0; i < ndsForSampling.size(); i++ )
        {
            pGraph->GetChildren( ndsForSampling[i], &(*chlds)[i] );
            (*chlds)[i].push_back( ndsForSampling[i]) ;
        }
        
    }
    
}
Exemple #4
0
void CAht::UpdateModelProperty( int id )
{
    //		プロパティの参照データを更新する
    //
    int i;
    int target;
    int a;
    AHTMODEL *model;
    AHTMODEL *m;
    AHTPROP *p;
    AHTPROP *p2;
    char *res;
    CStrNote note;
    char *list;
    char tmp[256];
    
    model = GetModel( id );
    if ( model == NULL ) return;
    target = id;
    
    for(i=0;i<model->GetPropCount();i++) {
        p = model->GetProperty( i );
        switch( p->ahttype ) {
            case AHTTYPE_PARTS_INT:
                res = p->newval;
                if ( res == NULL ) {
                    list = SearchModelByClassName( p->defval2 );
                    note.Select( list );
                    note.GetLine( tmp, 0, 255 );
                    p->SetNewVal( tmp );
                }
                target = p->GetValueInt();
                break;
            case AHTTYPE_PARTS_PROP_STRING:
                a = target;if ( *p->defval3 == 'm' ) a = id;				// 自分を参照するオプション
                m = GetModel( a );
                if ( m != NULL ) {
                    p2 = m->GetProperty( p->defval2 );
                    //Alertf( "%d:%d:%s:%s:%x",i,a,p->defval, p->defval2,p2 );
                    if ( p2 != NULL ) {
                        res = p2->GetValue();
                        p->SetNewVal( res );
                    }
                }
                break;
            case AHTTYPE_PARTS_OPT_STRING:
                a = target;if ( *p->defval3 == 'm' ) a = id;				// 自分を参照するオプション
                m = GetModel( a );
                if ( m != NULL ) {
                    res = m->GetAHTOption( p->defval2 );
                    if ( res != NULL ) {
                        p->SetNewVal( res );
                    }
                }
                break;
            default:
                break;
        }
    }
}
Exemple #5
0
void CAht::DeleteModel( int id )
{
	//			モデルを削除
	int i;
	int myid;
	AHTMODEL *model;
	AHTMODEL *m;
	model = GetModel( id );
	if ( model == NULL ) return;

	//			自分にリンクしているIDを探す
	myid = model->GetId();
	for(i=0;i<model_cnt;i++) {
		m = GetModel( i );
		if ( m != NULL ) {
			if ( m->GetNextID() == myid ) m->SetNextID( -1 );
			if ( m->GetPrevID() == myid ) m->SetPrevID( -1 );
		}
	}

	//			完全に削除
	delete model;
	mem_ahtmodel[id] = NULL;

	//			全体の情報を更新
	BuildGlobalID();
}
Exemple #6
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : flags - 
// Output : int
//-----------------------------------------------------------------------------
int CSprite::DrawModel( int flags, const RenderableInstance_t &instance )
{
	VPROF_BUDGET( "CSprite::DrawModel", VPROF_BUDGETGROUP_PARTICLE_RENDERING );
	//See if we should draw
	if ( !IsVisible() || ( m_bReadyToDraw == false ) )
		return 0;



	// Tracker 16432:  If rendering a savegame screenshot then don't draw sprites 
	//   who have viewmodels as their moveparent
	if ( g_bRenderingScreenshot || !r_drawviewmodel.GetBool() )
	{
		C_BaseViewModel *vm = ToBaseViewModel( GetMoveParent() );
		if ( vm )
		{
			return 0;
		}
	}

	//Must be a sprite
	if ( modelinfo->GetModelType( GetModel() ) != mod_sprite )
	{
		const char *modelName = modelinfo->GetModelName( GetModel() );
		char msg[256];
		V_snprintf( msg, 256, "Sprite %d has non-mod_sprite model %s (type %d)\n",
			entindex(), modelName, modelinfo->GetModelType( GetModel() ) );
		AssertMsgOnce( 0, msg );
		return 0;
	}

	float renderscale = GetRenderScale();
	if ( m_bWorldSpaceScale )
	{
		CEngineSprite *psprite = ( CEngineSprite * )modelinfo->GetModelExtraData( GetModel() );
		float flMinSize = MIN( psprite->GetWidth(), psprite->GetHeight() );
		renderscale /= flMinSize;
	}

	//Draw it
	int drawn = DrawSprite( 
		this,
		GetModel(), 
		GetAbsOrigin(), 
		GetAbsAngles(), 
		m_flFrame,				// sprite frame to render
		m_hAttachedToEntity,	// attach to
		m_nAttachment,			// attachment point
		GetRenderMode(),		// rendermode
		GetRenderFX(),
		(float)( GetRenderBrightness() * instance.m_nAlpha ) * ( 1.0f / 255.0f ) + 0.5f,	// alpha
		GetRenderColorR(),
		GetRenderColorG(),
		GetRenderColorB(),
		renderscale,			// sprite scale
		GetHDRColorScale()		// HDR Color Scale
		);

	return drawn;
}
Exemple #7
0
void DataModelListCtrl::Fill()
{
#if USE_DATALISTVIEW
    GetStore()->Reset(GetItemCount());
#else
    SetItemCount(GetModel() ? GetModel()->GetRowCount() : 0);
    Refresh();
#endif
}
Exemple #8
0
void Ship::Render(Graphics::Renderer *renderer, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform)
{
	if (IsDead()) return;

	m_shipFlavour.ApplyTo(GetModel());

	//angthrust negated, for some reason
	GetModel()->SetThrust(vector3f(m_thrusters), -vector3f(m_angThrusters));

	if (m_landingGearAnimation)
		m_landingGearAnimation->SetProgress(m_wheelState);

	//strncpy(params.pText[0], GetLabel().c_str(), sizeof(params.pText));
	RenderModel(renderer, viewCoords, viewTransform);

	// draw shield recharge bubble
	if (m_stats.shield_mass_left < m_stats.shield_mass) {
		const float shield = 0.01f*GetPercentShields();
		renderer->SetBlendMode(Graphics::BLEND_ADDITIVE);
		glPushMatrix();
		matrix4x4f trans = matrix4x4f::Identity();
		trans.Translate(viewCoords.x, viewCoords.y, viewCoords.z);
		trans.Scale(GetPhysRadius());
		renderer->SetTransform(trans);

		//fade based on strength
		Sfx::shieldEffect->GetMaterial()->diffuse =
			Color((1.0f-shield),shield,0.0,0.33f*(1.0f-shield));
		Sfx::shieldEffect->Draw(renderer);
		glPopMatrix();
		renderer->SetBlendMode(Graphics::BLEND_SOLID);
	}

	if (m_ecmRecharge > 0.0f) {
		// ECM effect: a cloud of particles for a sparkly effect
		vector3f v[100];
		for (int i=0; i<100; i++) {
			const double r1 = Pi::rng.Double()-0.5;
			const double r2 = Pi::rng.Double()-0.5;
			const double r3 = Pi::rng.Double()-0.5;
			v[i] = vector3f(viewTransform * (
				GetPosition() + GetPhysRadius() *
				vector3d(r1, r2, r3).Normalized()
			));
		}
		Color c(0.5,0.5,1.0,1.0);
		float totalRechargeTime = GetECMRechargeTime();
		if (totalRechargeTime >= 0.0f) {
			c.a = m_ecmRecharge / totalRechargeTime;
		}

		Sfx::ecmParticle->diffuse = c;
		renderer->SetBlendMode(Graphics::BLEND_ALPHA_ONE);
		renderer->DrawPointSprites(100, v, Sfx::ecmParticle, 50.f);
	}
}
void wxDataViewCtrl::AddChildren(wxDataViewItem const& parentItem)
{
  int noOfChildren;

  wxDataViewItemArray items;


  wxCHECK_RET(GetModel() != NULL,"Model pointer not initialized.");
  noOfChildren = GetModel()->GetChildren(parentItem,items);
  (void) GetModel()->ItemsAdded(parentItem,items);
}
Exemple #10
0
void wxDataViewCtrl::OnMouse(wxMouseEvent& event)
{
    event.Skip();

    if (GetModel() == NULL)
        return;

#if 0
    // Doesn't compile anymore
    wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(m_peer));

    int NoOfChildren;
    wxDataViewItemArray items;
    NoOfChildren = GetModel()->GetChildren( wxDataViewItem(), items);
    if (NoOfChildren == 0)
       return;
    wxDataViewItem firstChild = items[0];

    UInt16 headerHeight = 0;
    MacDataViewListCtrlPtr->GetHeaderButtonHeight(&headerHeight);


    if (event.GetY() < headerHeight)
    {
       unsigned int col_count = GetColumnCount();
       unsigned int col;
       for (col = 0; col < col_count; col++)
       {
           wxDataViewColumn *column = GetColumn( col );
           if (column->IsHidden())
              continue;

           Rect itemrect;
           ::GetDataBrowserItemPartBounds( MacDataViewListCtrlPtr->GetControlRef(),
              reinterpret_cast<DataBrowserItemID>(firstChild.GetID()), column->GetPropertyID(),
              kDataBrowserPropertyEnclosingPart, &itemrect );

           if (abs( event.GetX() - itemrect.right) < 3)
           {
               if (column->GetFlags() & wxDATAVIEW_COL_RESIZABLE)
                  SetCursor( wxCursor( wxCURSOR_SIZEWE ) );
               else
                  SetCursor( *wxSTANDARD_CURSOR );
               return;
           }
       }

    }

    SetCursor( *wxSTANDARD_CURSOR );
#endif
}
Exemple #11
0
Ship::Ship(const ShipType::Id &shipId): DynamicBody(),
	m_flightState(FLYING),
	m_alertState(ALERT_NONE),
	m_controller(0),
	m_thrusterFuel(1.0),
	m_reserveFuel(0.0),
	m_landingGearAnimation(nullptr)
{
	Properties().Set("flightState", EnumStrings::GetString("ShipFlightState", m_flightState));
	Properties().Set("alertStatus", EnumStrings::GetString("ShipAlertStatus", m_alertState));

	m_lastAlertUpdate = 0.0;
	m_lastFiringAlert = 0.0;
	m_shipNear = false;
	m_shipFiring = false;

	m_testLanded = false;
	m_launchLockTimeout = 0;
	m_wheelTransition = 0;
	m_wheelState = 0;
	m_dockedWith = nullptr;
	m_dockedWithPort = 0;
	SetShipId(shipId);
	m_thrusters.x = m_thrusters.y = m_thrusters.z = 0;
	m_angThrusters.x = m_angThrusters.y = m_angThrusters.z = 0;

	InitEquipSet();

	m_hyperspace.countdown = 0;
	m_hyperspace.now = false;
	for (int i=0; i<ShipType::GUNMOUNT_MAX; i++) {
		m_gun[i].state = 0;
		m_gun[i].recharge = 0;
		m_gun[i].temperature = 0;
	}
	m_ecmRecharge = 0;
	m_shieldCooldown = 0.0f;
	m_curAICmd = 0;
	m_aiMessage = AIERROR_NONE;
	m_decelerating = false;

	SetModel(m_type->modelName.c_str());
	SetLabel("UNLABELED_SHIP");
	m_skin.SetRandomColors(Pi::rng);
	m_skin.SetDecal(m_type->manufacturer);
	m_skin.Apply(GetModel());
	if(GetModel()->SupportsPatterns())
		GetModel()->SetPattern(Pi::rng.Int32(0, GetModel()->GetNumPatterns()-1));

	Init();
	SetController(new ShipController());
}
Exemple #12
0
void Settings_Reset()
{
	settings.remoteExtendingDisabled = FALSE;
	if ( GetModel() == TF5800 && GetModel() == TF5810t || GetModel() == TF5800t )
	{
		settings.mheg = TRUE;
	}
	else
	{
		settings.mheg = FALSE;
	}
	settings.quickAspectBlocker = FALSE;
}
void CGibbsSamplingInfEngine::Initialization()
{
  
  int nFactors = GetModel()->GetNumberOfFactors();
  pFactorVector *currentFactors = GetCurrentFactors();
  currentFactors->resize(nFactors);
  int i;
  for( i = 0; i < nFactors; i++ )
  {
    (*currentFactors)[i] = GetModel()->GetFactor(i);
  }
  
}
bool CSamplingInfEngine::CheckIsAllNdsTab() const
{
    const CStaticGraphicalModel *pGrModel = GetModel();
    int nnodes = pGrModel->GetNumberOfNodes();
    const CModelDomain *pMD = GetModel()->GetModelDomain();
    int i;
    for( i = 0; i < nnodes; i++ )
    {
	if(! pMD->GetVariableType(i)->IsDiscrete())
	{
	    return false;
	}
    }
    return true;
}
Exemple #15
0
void SpaceStation::InitStation()
{
	m_adjacentCity = 0;
	for(int i=0; i<NUM_STATIC_SLOTS; i++) m_staticSlot[i] = false;
	Random rand(m_sbody->GetSeed());
	const bool ground = m_sbody->GetType() == SystemBody::TYPE_STARPORT_ORBITAL ? false : true;
	m_type = SpaceStationType::RandomStationType(rand, ground);

	if(m_shipDocking.empty()) {
		m_shipDocking.reserve(m_type->NumDockingPorts());
		for (unsigned int i=0; i<m_type->NumDockingPorts(); i++) {
			m_shipDocking.push_back(shipDocking_t());
		}
		// only (re)set these if we've not come from the ::Load method
		m_doorAnimationStep = m_doorAnimationState = 0.0;
	}
	assert(m_shipDocking.size() == m_type->NumDockingPorts());

	// This SpaceStation's bay ports are an instance of...
	m_ports = m_type->Ports();

	SetStatic(ground);			// orbital stations are dynamic now

	// XXX hack. if we loaded a game then ModelBody::Load already restored the
	// model and we shouldn't overwrite it
	if (!GetModel())
		SetModel(m_type->ModelName().c_str());

	SceneGraph::Model *model = GetModel();

	m_navLights.reset(new NavLights(model, 2.2f));
	m_navLights->SetEnabled(true);

	if (ground) SetClipRadius(CITY_ON_PLANET_RADIUS);		// overrides setmodel

	m_doorAnimation = model->FindAnimation("doors");

	SceneGraph::ModelSkin skin;
	skin.SetDecal("pioneer");

	if (model->SupportsPatterns()) {
		skin.SetRandomColors(rand);
		skin.Apply(model);
		model->SetPattern(rand.Int32(0, model->GetNumPatterns()));
	} else {
		skin.Apply(model);
	}
}
Exemple #16
0
void CBaseTrainDoor :: Spawn( void )
{
	Precache();

	pev->movetype = MOVETYPE_PUSH;
	pev->solid = SOLID_BSP;

	SET_MODEL( edict(), GetModel( ));

	// is mapper forget set angles?
	if( pev->movedir == g_vecZero )
	{
		pev->movedir = Vector( 1, 0, 0 );
		SetLocalAngles( g_vecZero );
	}

	// save initial angles
	m_vecOldAngles = GetLocalAngles();	// ???
	m_vecPosition1 = GetLocalOrigin();	// member the initial position

	if( !pev->speed )
		pev->speed = 100;

	m_pUserData = WorldPhysic->CreateKinematicBodyFromEntity( this );
	door_state = TD_CLOSED;
	SetTouch( NULL );

	SetThink( &CBaseTrainDoor :: FindTrain );
	SetNextThink( 0.1 );
}
Exemple #17
0
void SpaceStation::TimeStepUpdate(const float timeStep)
{
	// rotate the thing
	double len = m_type->angVel * timeStep;
	if (!is_zero_exact(len)) {
		matrix3x3d r = matrix3x3d::RotateY(-len);		// RotateY is backwards
		SetOrient(r * GetOrient());
	}
	m_oldAngDisplacement = len;

	// reposition the ships that are docked or docking here
	for (int i=0; i<m_type->numDockingPorts; i++) {
		const shipDocking_t &dt = m_shipDocking[i];
		if (!dt.ship) { //free
			m_navLights->SetColor(i+1, NavLights::NAVLIGHT_GREEN);
			continue;
		}
		if (dt.stage == 1) //reserved
			m_navLights->SetColor(i+1, NavLights::NAVLIGHT_YELLOW);
		if (dt.ship->GetFlightState() == Ship::FLYING)
			continue;
		PositionDockedShip(dt.ship, i);
		m_navLights->SetColor(i+1, NavLights::NAVLIGHT_RED); //docked
	}

	if (m_doorAnimation)
		GetModel()->UpdateAnimations();
}
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
bool CNPC_Furniture::CreateVPhysics( void )
{
#ifndef HL2_DLL
	return false;
#endif

	if ( !m_BoneFollowerManager.GetNumBoneFollowers() )
	{
		KeyValues *modelKeyValues = new KeyValues("");
		if ( modelKeyValues->LoadFromBuffer( modelinfo->GetModelName( GetModel() ), modelinfo->GetModelKeyValueText( GetModel() ) ) )
		{
			// Do we have a bone follower section?
			KeyValues *pkvBoneFollowers = modelKeyValues->FindKey("bone_followers");
			if ( pkvBoneFollowers )
			{
				// Loop through the list and create the bone followers
				KeyValues *pBone = pkvBoneFollowers->GetFirstSubKey();
				while ( pBone )
				{
					// Add it to the list
					const char *pBoneName = pBone->GetString();
					m_BoneFollowerManager.AddBoneFollower( this, pBoneName );

					pBone = pBone->GetNextKey();
				}
			}
		}
		modelKeyValues->deleteThis();
	}

	return true;
}
// 武器の初期化(ブレード)
void CWeapon::Reset() {
    //Model = GetModel(L"WEAPON\\blade.x");
    //Scale = CVector(1.0f, 1, 1)*0.6f;//0.6f
    Model = GetModel(L"WEAPON\\sword.x");
    Scale = CVector(1.5f, 1, 1)*2.7f;//0.6f
    Color = CColor(1, 1, 1, 0.0f);//0.0
}
void CDirectPrintPrinterSettingView::NewDataL()
	{
	CDirectPrintModel& model = GetModel();
	TInt count = model.PrinterCount();

	TBuf<50> buf;
	TBool IsNewName = EFalse;
	for (TInt i=1; !IsNewName; i++)
		{
		buf.Format(_L("Printer%d"), count+i);
		IsNewName = ETrue;

		for (TInt j=0; j<count; j++)
			{
			TDirectPrintPrinterData printerData;
			model.GetPrinterDataL(j, printerData);
			if (printerData.iPrinterName.Compare(buf) == 0)
				{
				IsNewName = EFalse;
				break;
				}
			}
		}

	iPrinterId = model.NewPrinterId();
	iPrinterName.Copy(buf);
	iDriver = 0;
	iBearer = 0;
	iAccessPoint = 0;
//	iAccessPointName.Copy(_L("WLAN_ap1"));
//	iHostIp.SetAddress(3232235530);
	iPort = 80;
	iUserName.Copy(_L(""));
	iQue.Copy(_L(""));
	}
Exemple #21
0
int CAht::LoadProjectApply( int modelid, int fileid )
{
    HTPOBJ *obj;
    AHTPROP *prop;
    AHTMODEL *model;
    
    model = GetModel( modelid );
    if ( model == NULL ) return -1;
    
    obj = GetProjectFileObject( fileid );
    model->SetObj( (AHTOBJ *)GetProjectFileString( obj->ahtobj ) );
    obj++;
    
    //			プロパティ全設定
    while(1) {
        if ( obj->ahtsource != -1 ) break;
        //Alertf( "%s=%s", GetProjectFileString( obj->propname), GetProjectFileString( obj->defvalue )  );
        prop = model->GetProperty( GetProjectFileString( obj->propname) );
        if ( prop != NULL ) {
            prop->SetNewVal( GetProjectFileString( obj->defvalue ) );
        }
        //model->SetPropertyDefault( GetProjectFileString( obj->propname), GetProjectFileString( obj->defvalue )  );
        obj++;
    }
    return 0;
}
// UNDONE: right now this is pretty much a copy of the squid spit with minor changes to the way it does damage
void CBMortar:: Spawn( void )
{
	SetMoveType( MOVETYPE_FLYGRAVITY );
	SetClassname( "bmortar" );
	
	SetSolid( SOLID_BBOX );

	pSprite = CSprite::SpriteCreate( "sprites/mommaspit.vmt", GetAbsOrigin(), true ); 

	if ( pSprite )
	{
		pSprite->SetAttachment( this, 0 );
		pSprite->m_flSpriteFramerate = 5;

		pSprite->m_nRenderMode = kRenderTransAlpha;
		pSprite->SetBrightness( 255 );

		m_iFrame = 0;

		pSprite->SetScale( 2.5f );
	}

	UTIL_SetSize( this, Vector( 0, 0, 0), Vector(0, 0, 0) );

	m_maxFrame = (float)modelinfo->GetModelFrameCount( GetModel() ) - 1;
	m_flDmgTime = gpGlobals->curtime + 0.4;
}
Exemple #23
0
char *CAht::SearchModelByClassName( char *clsname )
{
    //		クラス名(前方一致)からモデルをリストアップ
    //
    int i;
    char tmp[64];
    AHTMODEL *model;
    
    if ( objlist != NULL ) delete objlist;
    objlist = new CMemBuf;
    
    for(i=0;i<model_cnt;i++) {
        model = GetModel( i );
        if ( model != NULL ) {
            if ( strncmp( clsname, model->GetClass(), strlen(clsname) ) == 0 ) {
                sprintf( tmp, "%d:" , i );
                objlist->PutStr( tmp );
                objlist->PutStr( model->GetName() );
                objlist->PutCR();
            }
        }
    }
    objlist->Put(0);
    return objlist->GetBuffer();
}
void CDirectPrintPrinterSettingView::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case EAknSoftkeyBack:
			{
			iListBox->StoreSettingsL();
			StoreDriverInfoL();
			StoreTypeInfoL();
			StoreBearerInfoL();
			StoreExtendSettingsL();
			WriteDataL(); // write to model
			GetBearerMgr()->SetJobSettings(); // write to bearer
			GetModel().SetIsNewData(EFalse);

			AppUi()->HandleCommandL(EDirectPrintCmdIdPrinterSettingViewBack);
			}
			break;
		default:
			{
			AppUi()->HandleCommandL(aCommand);
			}
			break;
		}
	}
Exemple #25
0
void DataModelListCtrl::InitColumns(bool row_column)
{
    const wxDataModelBase* model = GetModel();
    const DataViewColumnInfoVector vec = DataViewColumnInfoVector::MakeDefaultVector(model);

    InitColumns(vec, row_column);
}
Exemple #26
0
void DataModelListCtrl::InitColumns(const DataViewColumnInfoVector& columns, bool row_column)
{
    wxDataModelBase* model = GetModel();
    m_row_column = row_column;

    if (m_row_column)
        AppendColumn(wxEmptyString, wxLIST_FORMAT_LEFT, 75);

    wxASSERT(columns.size() == model->GetColumnCount());
    for (DataViewColumnInfoVector::const_iterator it = columns.begin(); it != columns.end(); it++)
    {
        wxAlignment align = it->GetAlignment();
        wxListColumnFormat format = wxLIST_FORMAT_LEFT;

        switch(align)
        {
            case wxALIGN_RIGHT:
                format = wxLIST_FORMAT_RIGHT; break;
            case wxALIGN_CENTER:
                format = wxLIST_FORMAT_CENTER; break;
            case wxALIGN_LEFT:
            case wxALIGN_INVALID:
            default:
                format = wxLIST_FORMAT_LEFT; break;
        }
        AppendColumn(it->Name, format, it->Width);
    }
    Fill();
}
Exemple #27
0
void DataModelListCtrl::InitColumns(const DataViewColumnInfoVector& columns, bool row_column)
{
    wxDataModelBase* model = GetModel();
    wxDataViewColumn* column;
    wxDataViewRenderer* tr;
    size_t col = 0;

    m_row_column = row_column;
    if (m_row_column)
    {
        wxASSERT(false);
        tr = new wxDataViewTextRenderer(wxT("long"), wxDATAVIEW_CELL_INERT);
        column = new wxDataViewColumn(wxEmptyString, tr, col, 75, wxALIGN_LEFT);
        AppendColumn(column);
    }

    wxASSERT(columns.size() == model->GetColumnCount());
    for (DataViewColumnInfoVector::const_iterator it = columns.begin(); it != columns.end(); it++)
    {
        wxAlignment align = it->GetAlignment();

        if ( (align == wxALIGN_RIGHT) && ((it + 1) == columns.end())) // last column expands to the right
            align = wxALIGN_LEFT;
        tr = GetRenderer(it->VariantType);
        wxString colName = it->Name;
    #ifdef x_DEBUG
        colName += wxString::Format(wxT(" %d"), col);
    #endif
        column = new wxDataViewColumn(colName, tr, col++, it->Width, align,
            wxDATAVIEW_COL_RESIZABLE | (it->Sortable ? wxDATAVIEW_COL_SORTABLE : 0));
        AppendColumn(column);
    }
    Fill();
}
vcollide_t *CModelInfo::GetVCollide( int modelIndex ) const
{
	extern vcollide_t *Mod_VCollide( model_t *pModel );
	// First model (index 0 )is is empty
	// Second model( index 1 ) is the world, then brushes/submodels, then players, etc.
	// So, we must subtract 1 from the model index to map modelindex to CM_ index
	// in cmodels, 0 is the world, then brushes, etc.
	if ( modelIndex < MAX_MODELS )
	{
		const model_t *pModel = GetModel( modelIndex );
		if ( pModel )
		{
			switch( pModel->type )
			{
			case mod_brush:
				return CM_GetVCollide( modelIndex-1 );
			case mod_studio:
				return Mod_VCollide( (model_t*)pModel );
			}
		}
		else
		{
			// we may have the cmodels loaded and not know the model/mod->type yet
			return CM_GetVCollide( modelIndex-1 );
		}
	}
	return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool C_FuncPhysicsRespawnZone::Initialize( void )
{
	if ( InitializeAsClientEntity( STRING(GetModelName()), RENDER_GROUP_OPAQUE_ENTITY ) == false )
		return false;

	SetSolid( SOLID_BSP );	
	AddSolidFlags( FSOLID_NOT_SOLID );
	AddSolidFlags( FSOLID_TRIGGER );	
	SetMoveType( MOVETYPE_NONE );

	const model_t *mod = GetModel();
	if ( mod )
	{
		Vector mins, maxs;
		modelinfo->GetModelBounds( mod, mins, maxs );
		SetCollisionBounds( mins, maxs );
	}

	Spawn();

	AddEffects( EF_NODRAW );

	UpdatePartitionListEntry();

	CollisionProp()->UpdatePartition();

	UpdateVisibility();

	SetNextClientThink( gpGlobals->curtime + (cl_phys_props_respawnrate.GetFloat() * RandomFloat(1.0,1.1)) );

	return true;
}
Exemple #30
0
void wxDataViewCtrl::SetSelections(wxDataViewItemArray const& sel)
{
    size_t const noOfSelections = sel.GetCount();

    size_t i;

    wxDataViewItem last_parent;


   // make sure that all to be selected items are visible in the control:
    for (i = 0; i < noOfSelections; i++)
    {
        wxDataViewItem item   = sel[i];
        wxDataViewItem parent = GetModel()->GetParent( item );

        if (parent.IsOk() && (parent != last_parent))
          ExpandAncestors(item);
        last_parent = parent;
    }

   // finally select the items:
    wxDataViewWidgetImpl* dataViewWidgetPtr(GetDataViewPeer()); // variable definition for abbreviational purposes

    for (i=0; i<noOfSelections; ++i)
      dataViewWidgetPtr->Select(sel[i]);
}