bool CDynaLightFX::Init(const FX_BASEDATA *pBaseData, const CBaseFXProps *pProps) { // Perform base class initialisation if (!CBaseFX::Init(pBaseData, pProps)) return false; ObjectCreateStruct ocs; ocs.m_ObjectType = OT_LIGHT; ocs.m_Scale = 1.0f; GetCurrentTransform(0.0f, ocs.m_Pos, ocs.m_Rotation); //setup whether or not it is in the sky ocs.m_Flags2 |= GetSkyFlags(GetProps()->m_eInSky); // Create the light m_hLight = g_pLTClient->CreateObject(&ocs); //setup static light properties //setup the LOD's associated with the light g_pLTClient->SetLightDetailSettings(m_hLight, GetProps()->m_eLightLOD, GetProps()->m_eWorldShadowsLOD, GetProps()->m_eObjectShadowsLOD); //setup the texture associated with the light g_pLTClient->SetLightTexture(m_hLight, GetProps()->m_pszTexture); //setup any extra properties UpdateDynamicProperties(0.0f); return true; }
bool CPolyTubeFX::Init(ILTClient *pClientDE, FX_BASEDATA *pBaseData, const CBaseFXProps *pProps) { LTVector vSave = pBaseData->m_vPos; // Perform base class initialisation if (!CBaseFX::Init(pClientDE, pBaseData, pProps)) return false; if( !GetProps()->m_nMaxTrailLength || !GetProps()->m_fTrailWidth ) return LTFALSE; ObjectCreateStruct ocs; INIT_OBJECTCREATESTRUCT(ocs); ocs.m_ObjectType = OT_NORMAL; ocs.m_Flags = pBaseData->m_dwObjectFlags | FLAG_NOLIGHT; ocs.m_Flags2 |= pBaseData->m_dwObjectFlags2; ocs.m_Pos = m_vCreatePos; m_hObject = m_pLTClient->CreateObject(&ocs); if( !m_hObject ) return false; // Are we rendering really close? m_bReallyClose = !!(pBaseData->m_dwObjectFlags & FLAG_REALLYCLOSE); // Make sure we don't exceed the total length of the polytrail.... LTVector vStart, vEnd; vStart = vSave; m_pLTClient->GetObjectPos(m_hParent, &vEnd); float fLen = (vStart - vEnd).Mag(); if (fLen > 256.0f) { // This is too big of a distance, start polytrail at the right spot... vSave = m_vPos; } // Add an initial point PT_TRAIL_SECTION ts; ts.m_vPos = vSave; ts.m_tmElapsed = 0.0f; ts.m_uVal = 0.0f; m_collPathPts.AddTail(ts); // Success !! return true; }
//handles updating the properties of the light given the specified unit time value void CDynaLightFX::UpdateDynamicProperties(float fUnitTime) { //update the type of this light g_pLTClient->SetLightType(m_hLight, GetEngineLightType(GetProps()->m_efcType.GetValue(fUnitTime))); //the intensity of the light float fIntensity = GetProps()->m_ffcIntensity.GetValue(fUnitTime); float fFlickerScale = GetProps()->m_ffcFlickerScale.GetValue(fUnitTime); g_pLTClient->SetLightIntensityScale(m_hLight, LTMAX(0.0f, fIntensity * GetRandom(fFlickerScale, 1.0f)) ); //get the color of this light LTVector vColor = ToColor3(GetProps()->m_cfcColor.GetValue(fUnitTime)); g_pLTClient->SetObjectColor(m_hLight, vColor.x, vColor.y, vColor.z, 1.0f); //and now the radius of the light float fRadius = GetProps()->m_ffcRadius.GetValue(fUnitTime); g_pLTClient->SetLightRadius(m_hLight, fRadius); //the specular color LTVector4 vSpecular = GetProps()->m_cfcSpecularColor.GetValue(fUnitTime); g_pLTClient->SetLightSpecularColor(m_hLight, ToColor3(vSpecular)); //the translucent color LTVector4 vTranslucent = GetProps()->m_cfcTranslucentColor.GetValue(fUnitTime); g_pLTClient->SetLightTranslucentColor(m_hLight, ToColor3(vTranslucent)); //the spot light information float fFovX = MATH_DEGREES_TO_RADIANS(GetProps()->m_ffcSpotFovX.GetValue(fUnitTime)); float fFovY = MATH_DEGREES_TO_RADIANS(GetProps()->m_ffcSpotFovY.GetValue(fUnitTime)); g_pLTClient->SetLightSpotInfo(m_hLight, fFovX, fFovY, 0.0f); }
//called to create a single piece of debris bool CDebrisSystemFX::CreateDebrisPiece(const LTRigidTransform& tObjTransform, uint32 nSystem, uint32 nType) { //we first need to determine the starting position and orientation of this piece of debris LTVector vObjPos = GenerateObjectSpaceDebrisPos(LTVector::GetIdentity(), GetProps()->m_vEmissionDims, GetProps()->m_fMinRadius, GetProps()->m_fMaxRadius); //determine the linear velocity of this rigid body in gu/s LTVector vObjVel = GenerateObjectSpaceDebrisVel(vObjPos, GetProps()->m_vMinLinearVelocity, GetProps()->m_vMaxLinearVelocity); //determine the initial orientation of the debris piece LTRotation rObjRot = GenerateObjectSpaceDebrisRot(vObjPos, vObjVel); //determine the transform in world space LTRigidTransform tWSTrans = tObjTransform * LTRigidTransform(vObjPos, rObjRot); //and also bring the velocity into world space LTVector vWSVel = tObjTransform.m_rRot.RotateVector(vObjVel); //determine the angular velocity of this rigid body in radians per second const LTVector& vAngMin = GetProps()->m_vMinAngularVelocity; const LTVector& vAngMax = GetProps()->m_vMaxAngularVelocity; LTVector vAngVel = LTVector(GetRandom(vAngMin.x, vAngMax.x), GetRandom(vAngMin.y, vAngMax.y), GetRandom(vAngMin.z, vAngMax.z)); //get the information we need for the type that we are creating const CDebrisSystemProps::STypeInfo& TypeInfo = GetProps()->m_Types[nType]; //and now create this rigid body HPHYSICSRIGIDBODY hRigidBody = g_pLTClient->PhysicsSim()->CreateRigidBody( TypeInfo.m_hShape, tWSTrans, false, PhysicsUtilities::ePhysicsGroup_UserDebris, nSystem, TypeInfo.m_fFriction, TypeInfo.m_fCOR); //verify that it worked if(hRigidBody == INVALID_PHYSICS_RIGID_BODY) return false; //we now need to setup our initial velocities on this rigid body g_pLTClient->PhysicsSim()->SetRigidBodyVelocity(hRigidBody, vWSVel); g_pLTClient->PhysicsSim()->SetRigidBodyAngularVelocity(hRigidBody, vAngVel); //we now have a rigid body, so we need to create an effect that will be attached to the rigid body CLIENTFX_CREATESTRUCT CreateStruct("", 0, hRigidBody, LTRigidTransform::GetIdentity()); CreateNewFX(m_pFxMgr, TypeInfo.m_pszEffect, CreateStruct, true); //we can now release our reference to the rigid body now that the newly created effect is using //that as it's parent g_pLTClient->PhysicsSim()->ReleaseRigidBody(hRigidBody); //success return true; }
bool CBaseFX::Init(const FX_BASEDATA *pData, const CBaseFXProps *pProps) { //make sure we have properties if(!pProps) return false; //save our prop pointer m_pProps = pProps; // Store the base data m_pFxMgr = pData->m_pFxMgr; //set us to face in the direction indicated to start at m_rAdditional = GetProps()->m_rInitialRotation; //setup the parent data if(pData->m_hParentRigidBody != INVALID_PHYSICS_RIGID_BODY) { SetParent(pData->m_hParentRigidBody, pData->m_tTransform); } else { SetParent(pData->m_hParentObject, pData->m_hNodeAttach, pData->m_hSocketAttach, pData->m_tTransform); } return true; }
LTVector CDebrisSystemFX::GenerateObjectSpaceDebrisVel(const LTVector& vObjSpacePos, const LTVector& vMinVelocity, const LTVector& vMaxVelocity) { LTVector vVel(0, 0, 0); // Randomize the velocity within our range switch(GetProps()->m_eVelocityType) { case eDebrisVelocity_Random: { vVel.x = GetRandom( vMinVelocity.x, vMaxVelocity.x ); vVel.y = GetRandom( vMinVelocity.y, vMaxVelocity.y ); vVel.z = GetRandom( vMinVelocity.z, vMaxVelocity.z ); } break; case eDebrisVelocity_Center: { //velocity direction is based upon position from 0, 0, 0 vVel = vObjSpacePos * (GetRandom(vMinVelocity.x, vMaxVelocity.x) / vObjSpacePos.Mag()); } break; default: LTERROR( "Unknown Debris velocity type"); break; } return vVel; }
bool CPolyFanFX::Init(ILTClient *pClientDE, FX_BASEDATA *pBaseData, const CBaseFXProps *pProps) { // Perform base class initialisation if (!CBaseFX::Init(pClientDE, pBaseData, pProps)) return false; LTVector vPos; if( m_hParent ) { m_pLTClient->GetObjectPos(m_hParent, &vPos); } else { vPos = m_vCreatePos; } LTVector vScale; vScale.Init(1.0f, 1.0f, 1.0f); ObjectCreateStruct ocs; INIT_OBJECTCREATESTRUCT(ocs); ocs.m_ObjectType = OT_NORMAL; ocs.m_Flags = 0; ocs.m_Pos = vPos; ocs.m_Scale = vScale; strcpy(ocs.m_Filename, GetProps()->m_sPolyFanName); m_hObject = m_pLTClient->CreateObject(&ocs); // Success !! return true; }
static UnencryptedProperties GetPropsOrAltProps(const char* path) { UnencryptedProperties props = GetProps(path); if (props.OK()) { return props; } return GetAltProps(path); }
//given a point in time, this will determine the position and orientation of this effect based upon //the parent attachments and other such factors void CBaseFX::GetCurrentTransform(float fUnitLifetime, LTVector& vPos, LTRotation& rRot) { //and apply it to our parent transform LTRigidTransform tAdditional = LTRigidTransform(GetProps()->m_vfcOffset.GetValue(fUnitLifetime), m_rAdditional); LTRigidTransform tFinal = m_tParentTransform * tAdditional; vPos = tFinal.m_vPos; rRot = tFinal.m_rRot; }
bool CFallingStuffFX::Init(ILTClient *pClientDE, FX_BASEDATA *pBaseData, const CBaseFXProps *pProps) { // Perform base class initialisation if (!CBaseFX::Init(pClientDE, pBaseData, pProps)) return false; // Store the first position as the last position m_vLastPos = pBaseData->m_vPos; // If we have a parent object, get it and apply it's rotation // to the plane direction m_vPlaneDir = GetProps()->m_vPlaneDir; if (m_hParent) { LTRotation orient; m_pLTClient->GetObjectRotation(m_hParent, &orient); LTMatrix mRot; Mat_SetBasisVectors(&mRot, &orient.Right(), &orient.Up(), &orient.Forward()); LTVector vTmp = m_vPlaneDir; MatVMul(&m_vPlaneDir, &mRot, &vTmp); } LTVector vUp; vUp.x = 0.0f; vUp.y = 1.0f; vUp.z = 0.0f; LTVector vTest = m_vPlaneDir; vTest.x = (float)fabs(vTest.x); vTest.y = (float)fabs(vTest.y); vTest.z = (float)fabs(vTest.z); if (vTest == vUp) { // Gotsta use another axis vUp.x = -1.0f; vUp.y = 0.0f; vUp.z = 0.0f; } m_vRight = m_vPlaneDir.Cross(vUp); m_vUp = m_vPlaneDir.Cross(m_vRight); // Create the base object CreateDummyObject(); // Success !! return true; }
bool CSpriteFX::Update(float tmFrameTime) { // Base class update first if( !CBaseSpriteFX::Update(tmFrameTime) ) return true; //determine the unit lifetime float fUnitLifetime = GetUnitLifetime(); //update the color of the sprite m_vColor = GetProps()->m_cfcColor.GetValue(fUnitLifetime); //and now determine the overall scale SetScale(m_fScale * GetProps()->m_ffcScale.GetValue(fUnitLifetime)); return true; }
//called to set the width used by the visibility, this will update the visibility primitive //of the sprite based upon its rendering style. void CBaseSpriteFX::SetVisScale(float fScale) { //determine the half dimensions of the sprite float fWidth = fScale / 2.0f; float fHeight = fWidth * GetProps()->m_fAspectRatio; float fDiag; if(GetProps()->m_bAlignToCamera) { fDiag = LTSqrt(LTSqr(fWidth) + LTSqr(fHeight) + LTSqr(GetProps()->m_fToCameraOffset)); } else { fDiag = LTSqrt(LTSqr(fWidth) + LTSqr(fHeight)); if(GetProps()->m_bAlignAroundZ) fDiag *= 2.0f; } g_pLTClient->GetCustomRender()->SetVisBoundingSphere(m_hObject, LTVector(0.0f, 0.0f, 0.0f), fDiag); }
bool CSpriteFX::Init(const FX_BASEDATA *pBaseData, const CBaseFXProps *pProps) { // Perform base class initialisation if( !CBaseSpriteFX::Init(pBaseData, pProps)) return false; //install our visible callback if we need to cast a visible ray if(GetProps()->m_bCastVisibleRay) { g_pLTClient->GetCustomRender()->SetVisibleCallback(m_hObject, CustomRenderVisibleCallback); } //determine a random overall scale m_fScale = GetRandom(GetProps()->m_fMinScale, GetProps()->m_fMaxScale); //also determine the largest scale possible so we don't have to update this every frame float fMaxScale = GetProps()->m_ffcScale.GetFirstValue(); for(uint32 nKey = 1; nKey < GetProps()->m_ffcScale.GetNumKeys(); nKey++) fMaxScale = LTMAX(fMaxScale, GetProps()->m_ffcScale.GetKey(nKey)); //and use this as our visible scale SetVisScale(fMaxScale * m_fScale); // Success !! return true; }
//function that handles the visible callback bool CSpriteFX::HandleVisibleCallback(const LTRigidTransform& tCamera, const LTRigidTransform& tSkyCamera) { // See if anything is blocking our path to the camera LTVector vObjPos; g_pLTClient->GetObjectPos(m_hObject, &vObjPos); if(!IsPointVisible(tCamera.m_vPos, vObjPos, IsInSky(GetProps()->m_eInSky))) { return false; } //visible return true; }
//an internal update functionality that must be called at the start of each effect's update //function. This does not return any value so it does not need to be checked void CBaseFX::BaseUpdate(float fTimeInterval) { LTASSERT(IsActive() && !IsSuspended(), "Error: Updated an effect that was either suspended or inactive"); //update the elapsed time m_tmElapsed += fTimeInterval; //handle updating the additional rotation of this object for this frame if(GetProps()->m_bUpdateRotation) { LTVector vAngles = GetProps()->m_vfcRotation.GetValue(GetUnitLifetime()); LTRotation rRotation( MATH_DEGREES_TO_RADIANS(vAngles.x) * fTimeInterval, MATH_DEGREES_TO_RADIANS(vAngles.y) * fTimeInterval, MATH_DEGREES_TO_RADIANS(vAngles.z) * fTimeInterval); m_rAdditional = rRotation * m_rAdditional; } //update our parent transformation as long as we aren't fixed, and actually have a parent if((m_hParentObject || m_hParentRigidBody) && (GetProps()->m_eFollowType != eFXFollowType_Fixed)) { UpdateParentTransform(); } }
static enum MAPISTATUS fetchmail_get_contents(TALLOC_CTX *mem_ctx, mapi_object_t *obj_message) { enum MAPISTATUS retval; struct SPropTagArray *SPropTagArray; struct SPropValue *lpProps; struct SRow aRow; uint32_t count; DATA_BLOB body; /* Build the array of properties we want to fetch */ SPropTagArray = set_SPropTagArray(mem_ctx, 0x13, PR_INTERNET_MESSAGE_ID, PR_INTERNET_MESSAGE_ID_UNICODE, PR_CONVERSATION_TOPIC, PR_CONVERSATION_TOPIC_UNICODE, PR_MSG_EDITOR_FORMAT, PR_BODY, PR_BODY_UNICODE, PR_HTML, PR_RTF_COMPRESSED, PR_SENT_REPRESENTING_NAME, PR_SENT_REPRESENTING_NAME_UNICODE, PR_DISPLAY_TO, PR_DISPLAY_TO_UNICODE, PR_DISPLAY_CC, PR_DISPLAY_CC_UNICODE, PR_DISPLAY_BCC, PR_DISPLAY_BCC_UNICODE, PR_HASATTACH, PR_MESSAGE_CODEPAGE); lpProps = talloc_zero(mem_ctx, struct SPropValue); retval = GetProps(obj_message, 0, SPropTagArray, &lpProps, &count); MAPIFreeBuffer(SPropTagArray); MAPI_RETVAL_IF(retval, retval, NULL); /* Build a SRow structure */ aRow.ulAdrEntryPad = 0; aRow.cValues = count; aRow.lpProps = lpProps; retval = fetchmail_get_body(mem_ctx, obj_message, &aRow, &body); MAPI_RETVAL_IF(retval, GetLastError(), NULL); if (body.length) { talloc_free(body.data); } return MAPI_E_SUCCESS; }
int e4crypt_enable(const char* path) { // Already enabled? if (s_key_store.find(path) != s_key_store.end()) { return 0; } // Not an encryptable device? UnencryptedProperties key_props = GetProps(path).GetChild(properties::key); if (!key_props.OK()) { return 0; } if (key_props.Get<std::string>(tag::master_key).empty()) { crypt_mnt_ftr ftr; if (cryptfs_create_default_ftr(&ftr, key_length)) { SLOGE("Failed to create crypto footer"); return -1; } // Scrub fields not used by ext4enc ftr.persist_data_offset[0] = 0; ftr.persist_data_offset[1] = 0; ftr.persist_data_size = 0; if (put_crypt_ftr_and_key(ftr, key_props)) { SLOGE("Failed to write crypto footer"); return -1; } crypt_mnt_ftr ftr2; if (get_crypt_ftr_and_key(ftr2, key_props)) { SLOGE("Failed to read crypto footer back"); return -1; } if (memcmp(&ftr, &ftr2, sizeof(ftr)) != 0) { SLOGE("Crypto footer not correctly written"); return -1; } } if (!UnencryptedProperties(path).Remove(properties::ref)) { SLOGE("Failed to remove key ref"); return -1; } return e4crypt_check_passwd(path, ""); }
LTFLOAT CPolyTubeFX::CalcCurWidth( ) { switch( GetProps()->m_eWidthStyle ) { case ePTWS_Constant: { return GetProps()->m_fTrailWidth; } break; case ePTWS_SmallToBig: { return GetProps()->m_fTrailWidth * ( LTFLOAT(m_collPathPts.GetSize() - 2) / LTFLOAT(GetProps()->m_nMaxTrailLength) ); } break; case ePTWS_SmallToSmall: { LTFLOAT fHalfPts = (GetProps()->m_nMaxTrailLength+1) * 0.5f; if( m_collPathPts.GetSize() < fHalfPts ) { return GetProps()->m_fTrailWidth * ( LTFLOAT(m_collPathPts.GetSize() - 2) / LTFLOAT(GetProps()->m_nMaxTrailLength) ); } else { return GetProps()->m_fTrailWidth * ( LTFLOAT(GetProps()->m_nMaxTrailLength - (m_collPathPts.GetSize() - 2 )) / LTFLOAT(GetProps()->m_nMaxTrailLength) ); } } break; case ePTWS_BigToSmall: { return GetProps()->m_fTrailWidth * ( LTFLOAT(GetProps()->m_nMaxTrailLength - (m_collPathPts.GetSize() - 2 )) / LTFLOAT(GetProps()->m_nMaxTrailLength) ); } break; default: return 0; } }
bool CBaseSpriteFX::Update(float tmFrameTime) { // Base class update first BaseUpdate(tmFrameTime); //update our object position LTRigidTransform tObjTrans; GetCurrentTransform(GetUnitLifetime(), tObjTrans.m_vPos, tObjTrans.m_rRot); g_pLTClient->SetObjectTransform(m_hObject, tObjTrans); //update our rotation and keep it in a reasonable numerical range m_fCurrRotationRad += GetProps()->m_fRotationVelRad * tmFrameTime; m_fCurrRotationRad = fmodf(m_fCurrRotationRad, MATH_TWOPI); return true; }
TEST_F(ContextTest, FromDeviceType) { cl_context_properties *DefaultProps = GetProps(); // Setup the filter on the CPU device -- it is the only device always // available. cl::Context Ctx(CL_DEVICE_TYPE_CPU, DefaultProps); std::vector<cl::Device> Devs = Ctx.getInfo<CL_CONTEXT_DEVICES>(); // 1) Workaround for silence a googletest warning. // 2) The CPU device is the default device in OpenCRun. cl_device_type ExpectedDevTy = CL_DEVICE_TYPE_CPU | CL_DEVICE_TYPE_DEFAULT; EXPECT_EQ(1u, Ctx.getInfo<CL_CONTEXT_NUM_DEVICES>()); EXPECT_EQ(1u, Devs.size()); EXPECT_EQ(ExpectedDevTy, Devs[0].getInfo<CL_DEVICE_TYPE>()); }
static void ShowProperties(HWND parent, Controller *ctrl, bool extended=false) { PropertiesLayout *layoutData = FindPropertyWindowByParent(parent); if (layoutData) { SetActiveWindow(layoutData->hwnd); return; } if (!ctrl) return; layoutData = new PropertiesLayout(); gPropertiesWindows.Append(layoutData); GetProps(ctrl, layoutData, extended); if (!CreatePropertiesWindow(parent, layoutData)) delete layoutData; }
bool CLTBModelFX::IsFinishedShuttingDown() { //if we are syncing to the model key, we are always done if(GetProps()->m_bSyncToKey) { return true; } //otherwise just ask the animation if it has completed ANIMTRACKERID nTracker; m_pLTClient->GetModelLT()->GetMainTracker( m_hObject, nTracker ); uint32 dwState = 0; m_pLTClient->GetModelLT()->GetPlaybackState(m_hObject,nTracker,dwState); return (bool)(!!(dwState & MS_PLAYDONE)); }
static void ShowProperties(HWND parent, Doc doc, DisplayModel *dm, bool extended=false) { PropertiesLayout *layoutData = FindPropertyWindowByParent(parent); if (layoutData) { SetActiveWindow(layoutData->hwnd); return; } if (!doc.IsEngine() && !doc.IsEbook()) return; layoutData = new PropertiesLayout(); gPropertiesWindows.Append(layoutData); GetProps(doc, layoutData, dm, extended); if (!CreatePropertiesWindow(parent, layoutData)) delete layoutData; }
bool CDynaLightFX::Update(float tmFrameTime) { // Base class update first if (!CBaseFX::Update(tmFrameTime)) return false; if (IsShuttingDown()) { m_pLTClient->SetLightRadius(m_hObject, 0); return true; } // If we're flickering, change some of the attributes slightly if (GetProps()->m_bFlicker) { float fRand = 0.3f + GetRandom(0.0f, 0.19f); m_red *= fRand; m_green *= fRand; m_blue *= fRand; } // Try to add some sort of intensity based off the alpha... m_red = LTCLAMP( m_red * m_alpha, 0.0f, 1.0f ); m_green = LTCLAMP( m_green * m_alpha, 0.0f, 1.0f ); m_blue = LTCLAMP( m_blue * m_alpha, 0.0f, 1.0f ); // Set the new light colour m_pLTClient->SetLightColor(m_hObject, m_red, m_green, m_blue); // Set the new light scale m_pLTClient->SetLightRadius(m_hObject, m_scale); // Success !! return true; }
void MAPITableIterator::Initialize(LPMAPITABLE pTable, LPMAPIFOLDER pFolder, MAPISession &session, ULONG ulItemTypeMask) { UNREFERENCED_PARAMETER(ulItemTypeMask); HRESULT hr = S_OK; m_session = &session; if (m_pParentFolder != NULL) { UlRelease(m_pParentFolder); m_pParentFolder = NULL; } if (m_pRows != NULL) FreeProws(m_pRows); m_pParentFolder = pFolder; m_pTable = pTable; hr = m_pTable->SetColumns(GetProps(), 0); if (FAILED(hr)) { throw GenericException(hr, L"MAPITableIterator::Initialize():SetColumns Failed.",ERR_SET_RESTRICTION, __LINE__, __FILE__); } if (GetSortOrder() != NULL) { if (FAILED(hr = m_pTable->SortTable(GetSortOrder(), 0))) { throw GenericException(hr, L"MAPITableIterator::Initialize():SortTable Failed.",ERR_SET_RESTRICTION, __LINE__, __FILE__); } } if (FAILED(hr = m_pTable->GetRowCount(0, &m_totalRows))) { throw GenericException(hr, L"MAPITableIterator::Initialize():GetRowCount Failed.",ERR_SET_RESTRICTION, __LINE__, __FILE__); } if (FAILED(hr = m_pTable->QueryRows(m_batchSize, 0, &m_pRows))) { throw GenericException(hr, L"MAPITableIterator::Initialize():QueryRows Failed.",ERR_SET_RESTRICTION, __LINE__, __FILE__); } }
bool CPolyFanFX::Update(float tmCur) { // Base class update first if (!CBaseFX::Update(tmCur)) return false; // Align if neccessary, to the rotation of our parent if ((m_hParent) && (GetProps()->m_nAlongNormal == 2)) { LTRotation parentRot; m_pLTClient->GetObjectRotation(m_hParent, &parentRot); m_pLTClient->SetObjectRotation(m_hObject, &parentRot); } // Success !! return true; }
bool CDynaLightFX::Init(ILTClient *pClientDE, FX_BASEDATA *pBaseData, const CBaseFXProps *pProps) { // Perform base class initialisation if (!CBaseFX::Init(pClientDE, pBaseData, pProps)) return false; LTVector vScale; vScale.Init(100.0f, 100.0f, 100.0f); ObjectCreateStruct ocs; INIT_OBJECTCREATESTRUCT(ocs); ocs.m_ObjectType = OT_LIGHT; ocs.m_Flags = pBaseData->m_dwObjectFlags; ocs.m_Flags2 |= pBaseData->m_dwObjectFlags2; ocs.m_Pos = m_vCreatePos; ocs.m_Rotation = m_rCreateRot; ocs.m_Scale = vScale; if(GetProps()->m_bForceLightWorld) { ocs.m_Flags2 |= FLAG2_FORCEDYNAMICLIGHTWORLD; } // Lights can't be really close ocs.m_Flags &= ~FLAG_REALLYCLOSE; // Create the light m_hObject = m_pLTClient->CreateObject(&ocs); // We want the colour updated thankyou m_bUpdateColour = true; m_bUpdateScale = true; // Success !! return true; }
int e4crypt_change_password(const char* path, int crypt_type, const char* password) { SLOGI("e4crypt_change_password"); auto key_props = GetProps(path).GetChild(properties::key); crypt_mnt_ftr ftr; if (get_crypt_ftr_and_key(ftr, key_props)) { SLOGE("Failed to read crypto footer back"); return -1; } auto mki = s_key_store.find(path); if (mki == s_key_store.end()) { SLOGE("No stored master key - can't change password"); return -1; } const unsigned char* master_key_bytes = reinterpret_cast<const unsigned char*>(&mki->second.master_key[0]); if (cryptfs_set_password(&ftr, password, master_key_bytes)) { SLOGE("Failed to set password"); return -1; } ftr.crypt_type = crypt_type; if (put_crypt_ftr_and_key(ftr, key_props)) { SLOGE("Failed to write crypto footer"); return -1; } if (!UnencryptedProperties(path).Set(properties::is_default, crypt_type == CRYPT_TYPE_DEFAULT)) { SLOGE("Failed to update default flag"); return -1; } return 0; }
bool CBaseSpriteFX::Init(const FX_BASEDATA *pBaseData, const CBaseFXProps *pProps) { // Perform base class initialisation if( !CBaseFX::Init(pBaseData, pProps)) return false; // Combine the direction we would like to face with our parents rotation... ObjectCreateStruct ocs; GetCurrentTransform(0.0f, ocs.m_Pos, ocs.m_Rotation); //create a custom render object with the associated material ocs.m_ObjectType = OT_CUSTOMRENDER; if(!GetProps()->m_bSolid) ocs.m_Flags2 |= FLAG2_FORCETRANSLUCENT; if(!GetProps()->m_bTranslucentLight) ocs.m_Flags |= FLAG_NOLIGHT; //setup whether or not it is in the sky ocs.m_Flags2 |= GetSkyFlags(GetProps()->m_eInSky); m_hObject = g_pLTClient->CreateObject( &ocs ); if( !m_hObject ) return false; //setup our rendering layer if(GetProps()->m_bPlayerView) g_pLTClient->GetRenderer()->SetObjectDepthBiasTableIndex(m_hObject, eRenderLayer_Player); //setup the callback on the object so that it will render us g_pLTClient->GetCustomRender()->SetRenderingSpace(m_hObject, eRenderSpace_World); g_pLTClient->GetCustomRender()->SetRenderCallback(m_hObject, CustomRenderCallback); g_pLTClient->GetCustomRender()->SetCallbackUserData(m_hObject, this); //load up the material for this particle system, and assign it to the object HMATERIAL hMaterial = g_pLTClient->GetRenderer()->CreateMaterialInstance(GetProps()->m_pszMaterial); g_pLTClient->GetCustomRender()->SetMaterial(m_hObject, hMaterial); g_pLTClient->GetRenderer()->ReleaseMaterialInstance(hMaterial); //handle random rotation if(GetProps()->m_bRandomRotation) m_fCurrRotationRad = GetRandom(0.0f, MATH_TWOPI); // Success !! return true; }
//this will generate the orientation to use for a piece of debris LTRotation CDebrisSystemFX::GenerateObjectSpaceDebrisRot(const LTVector& vObjSpacePos, const LTVector& vObjSpaceVel) { switch(GetProps()->m_eOrientationType) { case eDebrisOrientation_Random: return ConvertDirectionToOrientation(GenerateRandomUnitVector()); break; case eDebrisOrientation_Position: if(vObjSpacePos == LTVector::GetIdentity()) { return LTRotation::GetIdentity(); } else { return ConvertDirectionToOrientation(vObjSpacePos.GetUnit()); } break; case eDebrisOrientation_Parent: return LTRotation::GetIdentity(); break; case eDebrisOrientation_Velocity: if(vObjSpaceVel == LTVector::GetIdentity()) { return LTRotation::GetIdentity(); } else { return ConvertDirectionToOrientation(vObjSpaceVel.GetUnit()); } break; default: LTERROR("Warning: Invalid debris system rotation type specified"); return LTRotation::GetIdentity(); break; } }