void CDestructibleModel::CreateWorldModelDebris() { ILTServer* pServerDE = BaseClass::GetServerDE(); if (!pServerDE) return; const char* pName = GetObjectName(m_hObject); if (!pName || !pName[0]) return; // Find all the debris objects... int nNum = 0; char strKey[128]; memset(strKey, 0, 128); char strNum[18]; memset(strNum, 0, 18); HCLASS hWMDebris = pServerDE->GetClass("WorldModelDebris"); while (1) { // Create the keyname string... sprintf(strKey, "%sDebris%d", pName, nNum); // Find any debris with that name... ObjArray <HOBJECT, MAX_OBJECT_ARRAY_SIZE> objArray; pServerDE->FindNamedObjects(strKey, objArray); int numObjects = objArray.NumObjects(); if (!numObjects) return; for (int i = 0; i < numObjects; i++) { HOBJECT hObject = objArray.GetObject(i); if (pServerDE->IsKindOf(pServerDE->GetObjectClass(hObject), hWMDebris)) { WorldModelDebris* pDebris = (WorldModelDebris*)pServerDE->HandleToObject(hObject); if (!pDebris) break; LTVector vVel, vRotPeriods; vVel.Init(GetRandom(-200.0f, 200.0f), GetRandom(100.0f, 300.0f), GetRandom(-200.0f, 200.0f)); vRotPeriods.Init(GetRandom(-1.0f, 1.0f), GetRandom(-1.0f, 1.0f), GetRandom(-1.0f, 1.0f)); pDebris->Start(&vRotPeriods, &vVel); } } // Increment the counter... nNum++; } }
void Ladder::UpdatePhysics(ContainerPhysics* pCPStruct) { ILTServer* pServerDE = GetServerDE(); if (!pServerDE) return; if (IsCharacter(pCPStruct->m_hObject)) { CCharacter* pCharacter = (CCharacter*)pServerDE->HandleToObject(pCPStruct->m_hObject); if (pCharacter) { pCharacter->UpdateOnLadder(this, pCPStruct); } } }