//------------------------------------------------------------------------ Matrix34 CVehiclePartAnimated::GetDestroyedGeometryTM(const char* pJointName, unsigned int index) { if (pJointName[0] && m_pCharInstanceDestroyed) { IDefaultSkeleton &rICharacterModelSkeletonDestroyed = m_pCharInstanceDestroyed->GetIDefaultSkeleton(); ISkeletonPose* pSkeletonDestroyed = m_pCharInstanceDestroyed->GetISkeletonPose(); CRY_ASSERT(pSkeletonDestroyed); char buffer[256]; const char* pSuffix = !m_pSharedParameters->m_destroyedSuffix.empty() ? m_pSharedParameters->m_destroyedSuffix.c_str() : GetDestroyedGeometrySuffix(eVGS_Destroyed); if (index == 0) { cry_sprintf(buffer, "%s%s", pJointName, pSuffix); } else { cry_sprintf(buffer, "%s_debris_%u", pJointName, index); } buffer[sizeof(buffer) - 1] = '\0'; int16 jointIdForDestroyed = rICharacterModelSkeletonDestroyed.GetJointIDByName(buffer); if (jointIdForDestroyed > -1) return Matrix34(pSkeletonDestroyed->GetAbsJointByID(jointIdForDestroyed)); } Matrix34 identTM; identTM.SetIdentity(); return identTM; }
////////////////////////////////////////////////////////////////////////// // Session Quality Events SMMPlayerJoinedEvent::SMMPlayerJoinedEvent( CryFixedStringT<CRYLOBBY_USER_NAME_LENGTH>& name, CryUserID& uid, SCryMatchMakingConnectionUID& conUID ) { if( uid.get() ) { cry_sprintf( m_guid, sizeof(m_guid), uid.get()->GetGUIDAsString().c_str() ); } else { m_guid[0]=0; } m_conUID = conUID; cry_sprintf( m_name, sizeof(m_name), name.c_str() ); size = sizeof( SMMPlayerJoinedEvent ); type = eMMTelE_PlayerJoined; }
SMMPlayerReportLagEvent::SMMPlayerReportLagEvent( CryUserID& uid ) { if( uid.get() ) { cry_sprintf( m_guid, sizeof(m_guid), uid.get()->GetGUIDAsString().c_str() ); } else { m_guid[0]=0; } size = sizeof( SMMPlayerReportLagEvent ); type = eMMTelE_PlayerReportLag; }
SMMPlayerLeftEvent::SMMPlayerLeftEvent( CryUserID& uid, SCryMatchMakingConnectionUID& conUID) { if( uid.get() ) { cry_sprintf( m_guid, sizeof(m_guid), uid.get()->GetGUIDAsString().c_str() ); } else { m_guid[0]=0; } m_conUID = conUID; size = sizeof( SMMPlayerLeftEvent ); type = eMMTelE_PlayerLeft; }
SMMPlayerLeftMMEvent::SMMPlayerLeftMMEvent( SCryUserInfoResult* pUser, CrySessionID& id, int32 nCurrentPlayers, bool isLocal ) { CryFixedStringT<40> guid = pUser->m_userID.get()->GetGUIDAsString(); CryLog( "MMTel: User guid %s", guid.c_str() ); if( pUser->m_userID.get() ) { cry_sprintf( m_guid, sizeof(m_guid), guid.c_str() ); } else { m_guid[0]=0; } memcpy( m_userName, pUser->m_userName, sizeof(m_userName) ); id->AsCStr( m_sessionID, sizeof(m_sessionID) ); m_nCurrentPlayers = nCurrentPlayers; m_local = isLocal; size = sizeof( SMMPlayerLeftMMEvent ); type = eMMTelE_PlayerLeftMM; }
//------------------------------------------------------------------------ void CVehiclePartAnimated::FlagSkeleton(ISkeletonPose* pSkeletonPose,IDefaultSkeleton &rIDefaultSkeleton) { if (!pSkeletonPose) return; IPhysicalEntity* pPhysics = GetEntity()->GetPhysics(); if (!pPhysics) return; string name; int idWater = rIDefaultSkeleton.GetJointIDByName("proxy_water"); uint32 buoyancyParts = (idWater != -1) ? 1 : 0; uint32 jointCount = rIDefaultSkeleton.GetJointCount(); for (uint32 i = 0; i < jointCount; ++i) { int physId = pSkeletonPose->GetPhysIdOnJoint(i); if (physId >= 0) { CheckColltypeHeavy(physId); name = rIDefaultSkeleton.GetJointNameByID(i); // when water proxy available, remove float from all others // if no water proxy, we leave only "proxy" parts floating if (idWater != -1) { if (i == idWater) { SetFlags(physId, geom_collides, false); SetFlagsCollider(physId, 0); } else SetFlags(physId, geom_floats, false); } else { if (name.find("proxy") != string::npos) ++buoyancyParts; else SetFlags(physId, geom_floats, false); } // all objects which have a corresponding *_proxy on the skeleton // are set to ray collision only if (name.find("_proxy") == string::npos) { name.append("_proxy"); int proxyId = rIDefaultSkeleton.GetJointIDByName(name.c_str()); if (proxyId != -1) { // remove ray collision from hull proxy(s) SetFlags(pSkeletonPose->GetPhysIdOnJoint(proxyId), geom_colltype_ray | geom_colltype13, false); // get StatObj from main part, to connect proxies foreignData with it IStatObj* pStatObj = pSkeletonPose->GetStatObjOnJoint(i); if (pStatObj) { pe_params_part params; params.partid = proxyId; if (pPhysics->GetParams(¶ms)) { if (params.pPhysGeom && params.pPhysGeom->pGeom) params.pPhysGeom->pGeom->SetForeignData(pStatObj, 0); } } for (int p = 2; p < 6; ++p) { // check additional proxies, by naming convention _02, .. _05 char buf[64]; cry_sprintf(buf, "%s_%02i", name.c_str(), p); proxyId = rIDefaultSkeleton.GetJointIDByName(buf); if (proxyId == -1) break; int proxyPhysId = pSkeletonPose->GetPhysIdOnJoint(proxyId); if (proxyPhysId == -1) continue; SetFlags(proxyPhysId, geom_colltype_ray | geom_colltype13, false); // connect proxies to main StatObj (needed for bullet tests, decals) if (pStatObj) { pe_params_part params; params.partid = proxyPhysId; if (pPhysics->GetParams(¶ms)) { if (params.pPhysGeom && params.pPhysGeom->pGeom) params.pPhysGeom->pGeom->SetForeignData(pStatObj, 0); } } } // set ray-collision only on the part SetFlags(physId, geom_collides | geom_floats, false); SetFlags(physId, geom_colltype_ray | geom_colltype13, true); SetFlagsCollider(physId, 0); } } } } if (buoyancyParts == 0) { // as fallback, use part with largest volume for buoyancy int partId = -1; float maxV = 0.f; pe_status_nparts nparts; int numParts = pPhysics->GetStatus(&nparts); for (int i = 0; i < numParts; ++i) { pe_params_part params; params.ipart = i; if (pPhysics->GetParams(¶ms)) { float v = (params.pPhysGeomProxy) ? params.pPhysGeomProxy->V : params.pPhysGeom->V; if (v > maxV) { partId = params.partid; maxV = v; } } } if (partId != -1) SetFlags(partId, geom_floats, true); else GameWarning("[CVehiclePartAnimated]: <%s> has no buoyancy parts! (Check material for correct physicalization setup properties)",GetEntity()->GetName()); } int jointId, physId; if ((jointId = rIDefaultSkeleton.GetJointIDByName("proxy_skirt")) != -1) { if ((physId = pSkeletonPose->GetPhysIdOnJoint(jointId)) != -1) { SetFlags(physId, geom_collides | geom_floats, false); SetFlags(physId, geom_colltype_ray | geom_colltype13 | geom_colltype_player | geom_colltype_foliage, true); SetFlagsCollider(physId, 0); } } // remove collision flags from all _proxy geoms by debug cvar // useful for seeing through, testing ray proxies etc if (VehicleCVars().v_disable_hull > 0) { for (uint32 i = 0; i < rIDefaultSkeleton.GetJointCount(); ++i) { if (strstr(rIDefaultSkeleton.GetJointNameByID(i), "_proxy")) { SetFlags(pSkeletonPose->GetPhysIdOnJoint(i), geom_collides | geom_floats, false); SetFlagsCollider(pSkeletonPose->GetPhysIdOnJoint(i), 0); } } } }
virtual void GetConfiguration( SFlowNodeConfig &config ) { #ifndef _RELEASE static char pPresetsHelp[1024] = ""; if (pPresetsHelp[0] == 0) { cry_strcpy(pPresetsHelp, "Preset input values. When this is used, all parameter inputs are ignored.\n" ); for (int i = 0; i < NUM_PRESETS; i++) { char buf[300]; cry_sprintf(buf, "-- %s : Angle: (%4.3f,%4.3f,%4.3f) Shift: (%4.3f,%4.3f,%4.3f ) Freq: %3.1f Random: %3.1f Distance: %3.1f RangeMin: %3.1f RangeMax: %3.1f sustainDuration: %3.1f FadeInDur: %3.1f FadeOutDur: %3.1f \n", m_Presets[i].pName, m_Presets[i].angle.x, m_Presets[i].angle.y, m_Presets[i].angle.z, m_Presets[i].shift.x, m_Presets[i].shift.y, m_Presets[i].shift.z, m_Presets[i].frequency, m_Presets[i].randomness, m_Presets[i].distance, m_Presets[i].rangeMin, m_Presets[i].rangeMax, m_Presets[i].sustainDuration, m_Presets[i].fadeInDuration, m_Presets[i].fadeOutDuration ); cry_strcat(pPresetsHelp, buf); } } static char pPresetsEnumDef[100] = ""; if (pPresetsEnumDef[0] == 0) { cry_strcpy(pPresetsEnumDef, "enum_int:NoPreset=0," ); for (int i = 0; i < NUM_PRESETS; i++) { char buf[100]; cry_sprintf(buf, "%s=%1d,", m_Presets[i].pName, i + 1 ); cry_strcat(pPresetsEnumDef, buf); } } #endif static const SInputPortConfig in_config[] = { InputPortConfig_Void ( "Trigger", _HELP("Trigger to start shaking")), InputPortConfig<int> ( "Restrict", ER_None, _HELP("Restriction"), 0, _UICONFIG("enum_int:None=0,NoVehicle=1,InVehicle=2")), InputPortConfig<int> ( "View", VT_FirstPerson, _HELP("Which view to use. FirstPerson or Current (might be Trackview)."), 0, _UICONFIG("enum_int:FirstPerson=0,Current=1")), InputPortConfig<bool> ( "GroundOnly", false, _HELP("Apply shake only when the player is standing on the ground")), InputPortConfig<bool> ( "Smooth", false, _HELP("Smooth shakes avoid sudden direction changes.")), InputPortConfig<Vec3> ( "Angle", Vec3(0.7f, 0.7f, 0.7f), _HELP("Shake Angles")), InputPortConfig<Vec3> ( "Shift", Vec3(0.01f, 0.01f, 0.01f), _HELP("Shake shifting")), InputPortConfig<float>( "Frequency", 12.0f, _HELP("Frequency. Can be changed dynamically."), 0, _UICONFIG("v_min=0,v_max=100")), InputPortConfig<float>( "Randomness", 1.f, _HELP("Randomness")), InputPortConfig<float>( "Distance", 0.0f, _HELP("Distance to effect source. If an entity is asociated to the node, distance from that entity to the current camera will be used instead")), InputPortConfig<float>( "RangeMin", 0.0f, _HELP("Maximum strength effect range")), InputPortConfig<float>( "RangeMax", 30.0f, _HELP("Effect range")), InputPortConfig<float>( "SustainDuration", 0.f, _HELP("duration of the non fading part of the shake. (total duration is fadein + this + fadeout ). -1 = permanent")), InputPortConfig<float>( "FadeInDuration", 0.f, _HELP("Fade in time (seconds)")), InputPortConfig<float>( "FadeOutDuration", 3.f, _HELP("Fade out time (seconds)")), InputPortConfig_Void ( "Stop", _HELP("Stop the shaking (will fade out)")), #ifdef _RELEASE InputPortConfig<int> ( "Preset", 0, _HELP("Preset input values. When this is used, all parameter inputs are ignored.")), #else InputPortConfig<int> ( "Preset", 0, pPresetsHelp, 0, _UICONFIG(pPresetsEnumDef)), #endif {0} }; config.nFlags |= EFLN_TARGET_ENTITY; config.sDescription = _HELP("Camera View Shake node. If an entity is provided, its position will be used for the distance calculations instead of the raw 'distance' input."); config.pInputPorts = in_config; config.pOutputPorts = 0; config.SetCategory(EFLN_APPROVED); }