/////////////////////////////////////////////////////////////////////
| 112 | |
| 113 | ////////////////////////////////////////////////////////////////////////// |
| 114 | void CStaticObject::LoadObject( const CString &file,bool bForceReload ) |
| 115 | { |
| 116 | // Ignore loading if object name is same as before. |
| 117 | if (file == m_objectName && !m_loadFailed && !bForceReload) |
| 118 | return; |
| 119 | |
| 120 | m_objectName = file; |
| 121 | |
| 122 | if (!IsCreateGameObjects()) |
| 123 | return; |
| 124 | |
| 125 | CLogFile::FormatLine( "Loading Static Object %s",(const char*)file ); |
| 126 | |
| 127 | UnloadObject(); |
| 128 | |
| 129 | m_loadFailed = false; |
| 130 | |
| 131 | // Spawn new entity. |
| 132 | LoadEntity( "StaticEntity",true ); |
| 133 | // Load this static object to the entity. |
| 134 | IEntity *entity = GetIEntity(); |
| 135 | if (entity) |
| 136 | { |
| 137 | if (entity->GetCharInterface()->LoadCharacter( 0,file )) |
| 138 | { |
| 139 | entity->DrawCharacter(0,ETY_DRAW_NORMAL); |
| 140 | int flags = entity->GetCharInterface()->GetCharacter(0)->GetFlags(); |
| 141 | entity->GetCharInterface()->GetCharacter(0)->SetFlags(flags|CS_FLAG_UPDATE); |
| 142 | // Character loaded. |
| 143 | m_bCharacter = true; |
| 144 | } |
| 145 | else |
| 146 | { |
| 147 | // Object loaded. |
| 148 | entity->LoadObject( 0,m_objectName,1 ); |
| 149 | entity->DrawObject( 0,ETY_DRAW_NORMAL ); |
| 150 | m_bCharacter = false; |
| 151 | } |
| 152 | // CEntityObject the_object; |
| 153 | // if (entity->GetEntityObject(0,the_object)) |
| 154 | // { |
| 155 | // the_object.object->SetHideability(m_hidable); |
| 156 | // } |
| 157 | |
| 158 | entity->SetNetPresence(false); |
| 159 | entity->SetScale( GetScale().x ); |
| 160 | |
| 161 | if (mv_rigidBody) |
| 162 | { |
| 163 | //entity->SetNeedUpdate(true); |
| 164 | entity->CreateRigidBody(PE_RIGID, mv_density,mv_mass,0 ); |
| 165 | } |
| 166 | else |
| 167 | { |
| 168 | //entity->SetNeedUpdate(false); |
| 169 | entity->CreateStaticEntity( mv_mass,0 ); |
| 170 | } |
| 171 |
no test coverage detected