/* ================ idBrittleFracture::Break ================ */ void idBrittleFracture::Break( void ) { fl.takedamage = false; physicsObj.SetContents( CONTENTS_RENDERMODEL ); // ishtvan: overwrite with custom contents if present if( m_CustomContents != -1 ) { physicsObj.SetContents( m_CustomContents ); } physicsObj.SetContents( physicsObj.GetContents() | CONTENTS_TRIGGER ); // SR CONTENTS_RESONSE FIX if( m_StimResponseColl->HasResponse() ) { physicsObj.SetContents( physicsObj.GetContents() | CONTENTS_RESPONSE ); } UpdateSoundLoss(); }
/* ================ idBrittleFracture::Restore ================ */ void idBrittleFracture::Restore( idRestoreGame *savefile ) { int i, j , num; renderEntity.hModel = renderModelManager->AllocModel(); renderEntity.hModel->InitEmpty( brittleFracture_SnapshotName ); renderEntity.callback = idBrittleFracture::ModelCallback; renderEntity.noShadow = true; renderEntity.noSelfShadow = true; renderEntity.noDynamicInteractions = false; savefile->ReadInt( health ); savefile->Read( &fl, sizeof( fl ) ); // setttings savefile->ReadMaterial( material ); savefile->ReadMaterial( decalMaterial ); savefile->ReadFloat( decalSize ); savefile->ReadFloat( maxShardArea ); savefile->ReadFloat( maxShatterRadius ); savefile->ReadFloat( minShatterRadius ); savefile->ReadFloat( linearVelocityScale ); savefile->ReadFloat( angularVelocityScale ); savefile->ReadFloat( shardMass ); savefile->ReadFloat( density ); savefile->ReadFloat( friction ); savefile->ReadFloat( bouncyness ); savefile->ReadString( fxFracture ); // state savefile->ReadBounds(bounds); savefile->ReadBool( disableFracture ); savefile->ReadInt( lastRenderEntityUpdate ); savefile->ReadBool( changed ); savefile->ReadStaticObject( physicsObj ); RestorePhysics( &physicsObj ); savefile->ReadInt( num ); shards.SetNum( num ); for ( i = 0; i < num; i++ ) { shards[i] = new shard_t; } for ( i = 0; i < num; i++ ) { savefile->ReadWinding( shards[i]->winding ); savefile->ReadInt( j ); shards[i]->decals.SetNum( j ); for ( j = 0; j < shards[i]->decals.Num(); j++ ) { shards[i]->decals[j] = new idFixedWinding; savefile->ReadWinding( *shards[i]->decals[j] ); } savefile->ReadInt( j ); shards[i]->neighbours.SetNum( j ); for ( j = 0; j < shards[i]->neighbours.Num(); j++ ) { int index; savefile->ReadInt( index ); assert(index != -1); shards[i]->neighbours[j] = shards[index]; } savefile->ReadInt( j ); shards[i]->edgeHasNeighbour.SetNum( j ); for ( j = 0; j < shards[i]->edgeHasNeighbour.Num(); j++ ) { savefile->ReadBool( shards[i]->edgeHasNeighbour[j] ); } savefile->ReadInt( shards[i]->droppedTime ); savefile->ReadInt( shards[i]->islandNum ); savefile->ReadBool( shards[i]->atEdge ); savefile->ReadStaticObject( shards[i]->physicsObj ); if ( shards[i]->droppedTime < 0 ) { shards[i]->clipModel = physicsObj.GetClipModel( i ); } else { shards[i]->clipModel = shards[i]->physicsObj.GetClipModel(); } } savefile->ReadInt( m_AreaPortal ); savefile->ReadBool( m_bSoundDamped ); savefile->ReadFloat( m_lossBaseAI ); // grayman #3042 savefile->ReadFloat( m_lossBasePlayer ); // grayman #3042 UpdateSoundLoss(); }