예제 #1
0
void CObjectInfoDlg::OnChangeACE() 
{
	int acenum = m_AceType.GetCurSel();
	int acetype = 0;
	int table = 0;

	if (acenum == 0) table = 0;
	if (acenum == 1) table = 1;
	if (acenum == 2) table = 2;

	m_AceList.DeleteAllItems();

	int numaces;
	OINFO *oInfo;
	POSITION pos = g_dlls->GetStartPosition();
	DWORD nKey;

	// Find the DLL
	while (pos != NULL) 
	{
		g_dlls->GetNextAssoc(pos, nKey, oInfo);

		// Got it
		if (oInfo->extName == objname)
		{
			// Get the number of table entries
			numaces = oInfo->GetTable(table)->size();

			// Loop each ACE entry
			for (int i = 0; i < numaces; i++)
			{	
				// Get the pointer to current ACE
				ACESEntry2* pACE = oInfo->GetACEEntry(table, i);

				if(pACE == NULL || pACE->aceListName == "")
					continue; // Ignore null entries

				// Add name
				// Check for * (new)
				int item = -1;

				if (pACE->aceListName.Left(1) == "*")
					item = m_AceList.InsertItem(i, pACE->aceListName.Right(pACE->aceListName.GetLength() - 1), 0);
				else
					item = m_AceList.InsertItem(i, pACE->aceListName, 0);

				// Add number of parameters
				CString numberOfParameters;
				numberOfParameters.Format("%d", pACE->params.size());
				m_AceList.SetItemText(item, 1, numberOfParameters);

				// Add description
				m_AceList.SetItemText(item, 2, pACE->aceDisplayText);
			}

			break;
		}
	}
}
예제 #2
0
void AnimatorBar::AnimationHasChanged()
{
	if(m_pObjType)
	{
		OINFO* info = GetOINFO(m_pObjType->DLLIndex);

		vector<CObj*> objs;
		CObj* o;

		POSITION pos = application->layouts.GetHeadPosition();
		while(pos)
		{
			CLayout* layout = application->layouts.GetNext(pos);
			
			POSITION pos2 = layout->objects.GetStartPosition();

			for (int i = 0; i < layout->objects.GetCount(); i++) 
			{
				long ID;
				layout->objects.GetNextAssoc(pos2, ID, o);

				if (o->GetGlobalID() == m_pObjType->ObjectIdentifier)
						objs.push_back(o);

			}
		}

		// Now loop each of the objects and call the end animation function.
		for(vector<CObj*>::iterator i = objs.begin(); i!= objs.end(); i++)
		{
			if(info->ETOnNotify)
				info->ETOnNotify((*i)->editObject, 2);
		}
		if(objs.size() > 0)
			if(info->ETOnNotify)
				info->ETOnNotify((*objs.begin())->editObject, 3);
	}
}
예제 #3
0
bool CTypeChecker::ParamValid(CString objName, CString expName, int paramNum, int numParams, ExpType type)
{
	// Impossible to tell if this parameter is correct using an undefined type
	if (type == EXPTYPE_NULL)
		return true;

	objName.MakeLower();
	expName.MakeLower(); 

	CString movementName;
	ParseBehaviorExpression(objName, objName, movementName);

	CObjType* oT = LookupObjectType(objName, objMap);
	int DLLIndex;

	// Couldn't find object type: try family
	if (oT == NULL) {
		list<Family>::iterator f = find(pApp->families.begin(), pApp->families.end(), objName);

		// Not found
		if (f == pApp->families.end() || !f->is_in_use)
			return false;
		else
			DLLIndex = f->DLLIndex;

	}
	else DLLIndex = oT->DLLIndex;

	// Default value, eg. ObjectName(5)
	if (expName == "<default>") {

		// Default value is private variable flag requires one private variable parameter
		if (GetOINFO(DLLIndex)->ideFlags & OF_DEFAULTVALUE_PRIVATEVAR)
			return type == EXPTYPE_VARIABLENAME;
		// No other way of defining default value parameters
		else
			return true;
	}

	vector<ACESEntry2>* pTable;

	if (movementName != "") {
		CBehavior* m = LookupBehavior(oT, movementName);
		if (m == NULL) return false;

		OINFO* oInfo = GetOINFO(m->BehaviorDLLIndex);
		pTable = oInfo->GetTable(2);
	}
	else
		pTable = GetOINFO(DLLIndex)->GetTable(2);

	// Lookup the entry, and get its param type.
	int Count = pTable->size();
	for (int i = 0; i < Count; i++)
	{
		CString Exp = pTable->at(i).aceDisplayText;
		Exp.MakeLower();
		if (Exp == expName)
		{
			switch (pTable->at(i).params[paramNum].type)
			{
			case 1:		// Value
				return (type == EXPTYPE_INTEGER || type == EXPTYPE_FLOAT);
				
			case 2:		// String
				return (type == EXPTYPE_STRING);
			
			case 14:	// Private variable
				return (type == EXPTYPE_VARIABLENAME);

			}
		}
	}

	// Not found - undefined expression - allow
	return true;
}
예제 #4
0
bool CTypeChecker::ObjectExpressionExists(CString objName, CString expName)
{
	objName.MakeLower();
	expName.MakeLower();

	CString movementName;
	ParseBehaviorExpression(objName, objName, movementName);

	CObjType* oT = LookupObjectType(objName, objMap);
	int DLLIndex;

	// Couldn't find object type: try family
	if (oT == NULL) {
		list<Family>::iterator f = find(pApp->families.begin(), pApp->families.end(), objName);

		// Not found
		if (f == pApp->families.end() || !f->is_in_use)
			return false;
		else {
			DLLIndex = f->DLLIndex;
			oT = pApp->FindObjTypeFromNumber(f->identifier);
		}
	}
	else DLLIndex = oT->DLLIndex;

	// Behavior under object: objName[movementName]
	if (movementName != "") {
		CBehavior* m = LookupBehavior(oT, movementName);
		if (m == NULL) return false;

		OINFO* oInfo = GetOINFO(m->BehaviorDLLIndex);

		int Count = oInfo->GetTable(2)->size();

		for (int i = 0; i < Count; i++) {
			CString Exp = oInfo->GetACEEntry(2, i)->aceDisplayText;
			Exp.MakeLower();
			if (Exp == expName)
				return true;
		}

		return false;
	}

	OINFO* oInfo = GetOINFO(DLLIndex);

	if (oInfo == NULL)
		return false;

	// get count
	int Count = oInfo->GetTable(2)->size();

	for (int i = 0; i < Count; i++)
	{
		CString Exp = oInfo->GetACEEntry(2, i)->aceDisplayText;
		Exp.MakeLower();
		if (Exp == expName)
			return true;
	}

	// Expression name not found: allow if OF_UNDEFINEDEXPRESSIONS set
	return (oInfo->ideFlags & OF_UNDEFINEDEXPRESSIONS)!=0;
}
예제 #5
0
bool CTypeChecker::CheckParamCount(CString objName, CString expName, int numParams)
{
	objName.MakeLower();
	expName.MakeLower();

	CString movementName;
	ParseBehaviorExpression(objName, objName, movementName);

	CObjType* oT = LookupObjectType(objName, objMap);
	int DLLIndex;

	// Couldn't find object type: try family
	if (oT == NULL) {
		list<Family>::iterator f = find(pApp->families.begin(), pApp->families.end(), objName);

		// Not found
		if (f == pApp->families.end() || !f->is_in_use)
			return false;
		else {
			DLLIndex = f->DLLIndex;
			oT = pApp->FindObjTypeFromNumber(f->identifier);
		}

	}
	else DLLIndex = oT->DLLIndex;

	// Default value, eg. ObjectName(5)
	if (expName == "<default>") {
		// The default value is private variable flag requires 1 parameter for default value.
		if (GetOINFO(DLLIndex)->ideFlags & OF_DEFAULTVALUE_PRIVATEVAR)
			return numParams == 1;
		// There is no other way of defining the default value parameters
		else
			return true;
	}

	vector<ACESEntry2>* pTable;

	if (movementName != "") {
		CBehavior* m = LookupBehavior(oT, movementName);
		if (m == NULL) return false;

		OINFO* oInfo = GetOINFO(m->BehaviorDLLIndex);
		pTable = oInfo->GetTable(2);
	}
	else
		pTable = GetOINFO(DLLIndex)->GetTable(2);

	// get count
	int Count = pTable->size();
	for (int i = 0; i < Count; i++)
	{
		CString Exp = pTable->at(i).aceDisplayText;
		Exp.MakeLower();
		if (Exp == expName)
		{
			return pTable->at(i).params.size() == numParams;
		}
	}

	// Not found - undefined expression - allow.
	return true;
}
예제 #6
0
ExpType CTypeChecker::GetExpressionType(CString objName, CString expName)
{
	objName.MakeLower();
	expName.MakeLower();

	// No ACE system for default params yet.  Return any.
	if (expName == "<default>")
		return EXPTYPE_NULL;

	CString movementName;
	ParseBehaviorExpression(objName, objName, movementName);

	CObjType* oT = LookupObjectType(objName, objMap);
	int DLLIndex;

	// Couldn't find object type: try family
	if (oT == NULL) {
		list<Family>::iterator f = find(pApp->families.begin(), pApp->families.end(), objName);

		// Not found
		if (f == pApp->families.end() || !f->is_in_use)
			return EXPTYPE_NULL;
		else
			DLLIndex = f->DLLIndex;

	}
	else DLLIndex = oT->DLLIndex;

	vector<ACESEntry2>* pTable;

	if (movementName != "") {
		CBehavior* m = LookupBehavior(oT, movementName);
		if (m == NULL) return EXPTYPE_NULL;

		OINFO* oInfo = GetOINFO(m->BehaviorDLLIndex);
		pTable = oInfo->GetTable(2);
	}
	else
		pTable = GetOINFO(DLLIndex)->GetTable(2);

	// Find expression and get type
	int Count = pTable->size();
	for (int i = 0; i < Count; i++)
	{
		CString Exp = pTable->at(i).aceDisplayText;
		Exp.MakeLower();
		if (Exp == expName)
		{
			switch (pTable->at(i).retrn)
			{
			case 0:
				return EXPTYPE_NULL;
			case RETURN_INTEGER:
				return EXPTYPE_INTEGER;
			case RETURN_FLOAT:
				return EXPTYPE_FLOAT;
			case RETURN_STRING:
				return EXPTYPE_STRING;
			case RETURN_ARRAY:
				return EXPTYPE_ARRAY;
			}
		}
	}

	// Return type is 'any' if not found
	return EXPTYPE_NULL;
}
예제 #7
0
void ObjectBarDialog::OnDblClickObject(NMHDR *pNMHDR, LRESULT *pResult)
{
	POSITION Pos = objects.GetFirstSelectedItemPosition();
	int Item = objects.GetNextSelectedItem(Pos);

	if (Item == -1) return;

	CObjType* pType;
	long ID = objects.GetItemData(Item);

	if (ID == -1)  // object folder
	{
		if (folderfilter == -1)  //Default folder
		{
			for(int i=0; i < application->object_folders.size(); i++)
			{
				if (objects.GetItemText(Item,0) == application->object_folders[i].name)
				{
					folderfilter=i;
					break;
				}
			}
		}
		else //return folder
		{
			folderfilter = -1;
		}
		Refresh();
		return;
	}

	application->object_types.Lookup(ID, pType);

	if (!pType) return;

	// If layout editor open..
	if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
	{
		POSITION ObjectPos = layout->objects.GetStartPosition();
		CObj* pObject;
		long ID = 0;

		for (int i = 0; i < layout->objects.GetCount(); i++) 
		{
			layout->objects.GetNextAssoc(ObjectPos, ID, pObject);

			CObjType* type = pObject->GetObjectType(application);

			if (type->ObjectIdentifier == pType->ObjectIdentifier)
			{
				OINFO* info = GetOINFO(pType->DLLIndex);
				if(info->ETOnNotify)
					info->ETOnNotify(pObject->editObject, 1);

				return;
			}
		}
	}

	// If event sheet editor, see if it has conditions. If so, open Event Wizard
	if ((parent.m_tabs.SelectionGet() == 1) && (parent.m_tabs.ItemGetCount() == 2) || parent.m_tabs.ItemGetCount() == 1)
	{
		bool bUse = false;

		for (int i = 0; i < pType->GetTableCount(CONDITION); i++)
		{
			ACESEntry2* pAce = pType->GetACESEntry(CONDITION, i);
			if(pAce == NULL || pAce->aceListName == "")
				continue; // Ignore null entries

			bUse = true;
		}

		if (bUse)
		{
			parent.m_pEventView[0][0]->m_InitialStage = 2;
			parent.m_pEventView[0][0]->m_InitialSelect = ID;
			parent.m_pEventView[0][0]->m_OldName = pType->GetName();
			parent.m_pEventView[0][0]->AddCondition(true);
		}
	}
}
예제 #8
0
void ObjectBarDialog::OnClickObject(NMHDR *pNMHDR, LRESULT *pResult)
{
	POSITION Pos = objects.GetFirstSelectedItemPosition();
	int Item = objects.GetNextSelectedItem(Pos);

	if (!layout) return;

	if (layout->m_ObjectFrameIsLockedTo != 0) // InputLocked()
		return;

	// Select in layout editor, if it's open
	if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
	{
		parent.layout_editor[0][0]->m_sel.RemoveAll();

		// This is intentionally here; clear selection if clicked on whitespace
		if(Item == -1)
		{
			parent.layout_editor[0][0]->Invalidate();
			g_PropertyBar->Update(parent.layout_editor[0][0], TYPE_LAYOUT, NULL, layout, NULL, application); 

			return;
		}

		// Now we have to wangle in the selected object
		int ObjectIdentifier = objects.GetItemData(Item);

		if (ObjectIdentifier==-1)
			return; //folder

		CObj*			pObject = 0;
		CObjType*		pObjectType = 0;

		POSITION LayerPos = layout->layers.GetHeadPosition();

		// So we have to find all the CObj's with this CObjType in the layout, and add them
		// For each layer
		while(LayerPos)
		{
			CLayer* pLayer = layout->layers.GetNext(LayerPos);

			// Loop all objects
			CObjList Objects;
			pLayer->GetEveryObject(Objects, layout);

			POSITION ObjectPos = Objects.GetHeadPosition();

			for (int i = 0; i < Objects.GetCount(); i++) 
			{
				CObj* pTestObject;
				long ID = Objects.GetNext(ObjectPos);
				layout->objects.Lookup(ID, pTestObject);

				if (pTestObject->GetGlobalID() != -1) 
				{
					CObjType* pTestType = pTestObject->GetObjectType(application);

					if (pTestType->ObjectIdentifier == ObjectIdentifier)
					{
						pObjectType = pTestType;
						pObject = pTestObject;

						long nKey = pObject->GetInstanceID();
						parent.layout_editor[0][0]->m_sel.AddTail(nKey);
					}
				}
			}
		}

		g_PropertyBar->Update(parent.layout_editor[0][0], TYPE_OBJECT, &parent.layout_editor[0][0]->m_sel, layout, &layout->objects, application); // Show object properties

		parent.layout_editor[0][0]->Invalidate();

		// While we're here, show animations for object
		// Future note: .. to be continued

		if(!pObjectType)
			return;

		int iRoot = -1;
		OINFO* oInfo = GetOINFO(pObjectType->DLLIndex);
		if (oInfo->ETGetAnimationHandle)
		{
			oInfo->ETGetAnimationHandle(pObject->editObject, iRoot);
			pMainWnd->animator.UpdateAnimations(application, layout, pObjectType, iRoot);
		}
	}
}