MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / net_Spawn

Method net_Spawn

ogsr_engine/xrGame/GameObject.cpp:212–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210void VisualCallback(IKinematics* tpKinematics);
211
212BOOL CGameObject::net_Spawn(CSE_Abstract* DC)
213{
214 VERIFY(!m_spawned);
215 if (m_spawned)
216 Msg("!![%s] Already spawned object detected: [%s]", __FUNCTION__, this->cName().c_str());
217
218 m_spawned = true;
219 m_spawn_time = Device.dwFrame;
220 CSE_Abstract* E = (CSE_Abstract*)DC;
221 VERIFY(E);
222
223 // Naming
224 cName_set(E->s_name);
225 cNameSect_set(E->s_name);
226 if (E->name_replace()[0])
227 cName_set(E->name_replace());
228
229 setID(E->ID);
230 // R_ASSERT(Level().Objects.net_Find(E->ID) == NULL);
231
232 const CSE_Visual* visual = smart_cast<const CSE_Visual*>(E);
233 if (visual)
234 {
235 LPCSTR saved_visual = visual_name(E);
236
237 if (pSettings->line_exist(cNameSect(), "visual"))
238 {
239 shared_str config_visual = pSettings->r_string(cNameSect(), "visual");
240
241 string_path config_visual_file;
242 if (0 == strext(*config_visual))
243 strconcat(sizeof(config_visual_file), config_visual_file, *config_visual, ".ogf");
244 else
245 strcpy_s(config_visual_file, sizeof(config_visual_file), *config_visual);
246 xr_strlwr(config_visual_file);
247
248 string_path saved_visual_file;
249 if (0 == strext(saved_visual))
250 strconcat(sizeof(saved_visual_file), saved_visual_file, saved_visual, ".ogf");
251 else
252 strcpy_s(saved_visual_file, sizeof(saved_visual_file), saved_visual);
253 xr_strlwr(saved_visual_file);
254
255 bool keep_visual = READ_IF_EXISTS(pSettings, r_bool, cNameSect().c_str(), "keep_visual", false);
256 if (keep_visual)
257 {
258 if (xr_strcmp(config_visual_file, saved_visual_file))
259 {
260 Msg("! [%s]: changed visual_name[%s] found in %s, keep original %s instead", __FUNCTION__, saved_visual, cName().c_str(), config_visual.c_str());
261 }
262 }
263 else if (!FS.exist(saved_visual) && !FS.exist("$level$", saved_visual_file) && !FS.exist("$game_meshes$", saved_visual_file))
264 {
265 Msg("! [%s]: visual_name[%s] not found in %s, keep original %s instead", __FUNCTION__, saved_visual, cName().c_str(), config_visual.c_str());
266 }
267 else
268 cNameVisual_set(saved_visual);
269 }

Callers

nothing calls this directly

Calls 15

MsgFunction · 0.85
setIDFunction · 0.85
strextFunction · 0.85
XFORMFunction · 0.85
PH_DBG_ObjectTrackFunction · 0.85
fis_zeroFunction · 0.85
setLocalFunction · 0.85
setReadyFunction · 0.85
reloadFunction · 0.85
alife_objectFunction · 0.85
spawn_suppliesFunction · 0.85
name_replaceMethod · 0.80

Tested by

no test coverage detected