MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / LoadObject

Method LoadObject

Editor/Objects/StatObj.cpp:114–205  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

112
113//////////////////////////////////////////////////////////////////////////
114void 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

Callers 4

SetPrefabMethod · 0.45
RedoMethod · 0.45
UndoMethod · 0.45
LoadObjectsMethod · 0.45

Calls 15

GetIEntityFunction · 0.85
GetCharInterfaceMethod · 0.80
SetNetPresenceMethod · 0.80
LoadCharacterMethod · 0.45
DrawCharacterMethod · 0.45
GetFlagsMethod · 0.45
GetCharacterMethod · 0.45
SetFlagsMethod · 0.45
DrawObjectMethod · 0.45
SetScaleMethod · 0.45
CreateRigidBodyMethod · 0.45
CreateStaticEntityMethod · 0.45

Tested by

no test coverage detected