Exemplo n.º 1
0
 void C_List::AddText(const std::string& str)
 {
     C_Text* text = new C_Text();
     text->SetFont("georgia", 12);
     text->SetText(str.c_str(), C_Color(0));
     text->SetPosition(2, (int)m_Texts.size()*m_TextHeight);
     m_Texts.push_back(text);
     m_Stack.push_back(str);
 }
Exemplo n.º 2
0
int UI_Deaggregate (ObjectiveClass* objective)
{
	int						f,fid;
	VehicleID				classID;
	Falcon4EntityClassType* classPtr;
	float					x,y,z;
	FeatureClassDataType*	fc;
	ObjClassDataType*		oc;
	BSPLIST					*drawptr;
	Tpoint					objPos;
	C_Window				*win;
	C_Text					*txt;
	C_TreeList				*tree;
	TREELIST				*item,*parent,*root;
	C_Entity				*recon_ent;
	C_Feature				*feat;

	if(gUIViewer == NULL)
		return(0);

	CloseAllRenderers(RECON_WIN);
	win=gMainHandler->FindWindow(RECON_WIN);
	if(win == NULL)
		return(0);

	tree=(C_TreeList*)win->FindControl(RECON_TREE);
	if(!tree)
		return(0);

	root=tree->Find(objective->GetTeam());
	if(!root)
	{
		txt=new C_Text;
		txt->Setup(C_DONT_CARE,0);
		txt->SetFixedWidth(100);
		txt->SetFont(tree->GetFont());
		txt->SetText(TeamInfo[objective->GetTeam()]->GetName());
		txt->SetFGColor(0xc0c0c0);

		root=tree->CreateItem(objective->GetTeam(),C_TYPE_ROOT,txt);
		if(root)
			tree->AddItem(tree->GetRoot(),root);

	}
	if(!root)
		return(0);

	recon_ent=BuildObjective(objective);

	parent=tree->CreateItem(objective->GetCampID(),C_TYPE_MENU,recon_ent);
	if(parent)
		tree->AddChildItem(root,parent);

	// Set up the init data structure.
	oc = objective->GetObjectiveClassData();
	fid = oc->FirstFeature;
	for (f=0; f<oc->Features; f++,fid++)
	{
		classID = static_cast<short>(objective->GetFeatureID(f));
		if (classID)
		{
			fc = GetFeatureClassData (classID);
			if (!fc || fc->Flags & FEAT_VIRTUAL)
				continue;
			objective->GetFeatureOffset(f, &y, &x, &z);
			objPos.x=x+objective->XPos();
			objPos.y=y+objective->YPos();
			objPos.z=z;
			classPtr = &Falcon4ClassTable[fc->Index];
			if(classPtr != NULL)
			{
				drawptr=LoadFeature(objective->GetCampID() << 16 | f,classPtr->visType[objective->GetFeatureStatus(f)],&objPos,(float)FeatureEntryDataTable[fid].Facing);
				if(drawptr != NULL)
				{
//					if(objective->GetFeatureValue(f))
//					{
						((DrawableObject*)drawptr)->GetPosition(&objPos);

						feat=BuildFeature(objective,f,&objPos);
						if(feat)
						{
							item=tree->CreateItem(objective->GetCampID() << 16 | f,C_TYPE_ITEM,feat);
							if(item)
								tree->AddChildItem(parent,item);
						}
//					}
				}
			}
		}
	}
	tree->RecalcSize();
	if(tree->Parent_)
		tree->Parent_->RefreshClient(tree->GetClient());
	return(1);
}