BGE patch: support runtime duplication of groups. Adding an object with Dupligroup option set will cause the group to be instantiated. No special actuator is needed for this feature, just put dupligroup objects in inactive layers and add them dynamically

This commit is contained in:
Benoit Bolsee
2008-07-26 11:00:21 +00:00
parent 9f803439c7
commit c4116a7f8d
4 changed files with 43 additions and 17 deletions

View File

@@ -127,12 +127,17 @@ void SCA_LogicManager::RegisterGameMeshName(const STR_String& gamemeshname, void
void SCA_LogicManager::RegisterGameObj(CValue* gameobj, void* blendobj)
void SCA_LogicManager::RegisterGameObj(void* blendobj, CValue* gameobj)
{
m_map_gameobj_to_blendobj.insert(CHashedPtr(gameobj), blendobj);
m_map_blendobj_to_gameobj.insert(CHashedPtr(blendobj), gameobj);
}
void SCA_LogicManager::UnregisterGameObj(void* blendobj, CValue* gameobj)
{
void **obp = m_map_blendobj_to_gameobj[CHashedPtr(blendobj)];
if (obp && (CValue*)(*obp) == gameobj)
m_map_blendobj_to_gameobj.remove(CHashedPtr(blendobj));
}
CValue* SCA_LogicManager::GetGameObjectByName(const STR_String& gameobjname)
{
@@ -146,10 +151,10 @@ CValue* SCA_LogicManager::GetGameObjectByName(const STR_String& gameobjname)
}
void* SCA_LogicManager::FindBlendObjByGameObj(CValue* gameobject)
CValue* SCA_LogicManager::FindGameObjByBlendObj(void* blendobj)
{
void **obp= m_map_gameobj_to_blendobj[CHashedPtr(gameobject)];
return obp?*obp:NULL;
void **obp= m_map_blendobj_to_gameobj[CHashedPtr(blendobj)];
return obp?(CValue*)(*obp):NULL;
}