/*virtual*/ void WBPEEldGetItem::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam ) const { WBParamEvaluator::SEvaluatedParam EntityValue; m_EntityPE->Evaluate( Context, EntityValue ); WBEntity* const pEntity = EntityValue.GetEntity(); if( !pEntity ) { return; } WBCompEldInventory* const pInventory = GET_WBCOMP( pEntity, EldInventory ); if( !pInventory ) { return; } WBParamEvaluator::SEvaluatedParam SlotValue; m_SlotPE->Evaluate( Context, SlotValue ); ASSERT( SlotValue.m_Type == WBParamEvaluator::EPT_String ); const HashedString SlotHash = SlotValue.m_String; WBEntity* const pItem = pInventory->GetItem( SlotHash ); EvaluatedParam.m_Type = WBParamEvaluator::EPT_Entity; EvaluatedParam.m_Entity = pItem; }
void WBPENOT::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam ) const { WBParamEvaluator::SEvaluatedParam Value; m_Input->Evaluate( Context, Value ); EvaluatedParam.m_Type = WBParamEvaluator::EPT_Bool; EvaluatedParam.m_Bool = !Value.GetBool(); }
void WBPEOR::Evaluate(const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam) const { WBParamEvaluator::SEvaluatedParam ValueA; m_InputA->Evaluate(Context, ValueA); WBParamEvaluator::SEvaluatedParam ValueB; m_InputB->Evaluate(Context, ValueB); EvaluatedParam.m_Type = WBParamEvaluator::EPT_Bool; EvaluatedParam.m_Bool = ValueA.GetBool() || ValueB.GetBool(); }
void WBPESquare::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam) const { WBParamEvaluator::SEvaluatedParam Value; m_Input->Evaluate(Context, Value); ASSERT(Value.m_Type == WBParamEvaluator::EPT_Int || Value.m_Type == WBParamEvaluator::EPT_Float); if (Value.m_Type == WBParamEvaluator::EPT_Int) { EvaluatedParam.m_Type = WBParamEvaluator::EPT_Int; EvaluatedParam.m_Int = Square(Value.m_Int); } else { EvaluatedParam.m_Type = WBParamEvaluator::EPT_Float; EvaluatedParam.m_Float = Square(Value.GetFloat()); } }
/*virtual*/ void WBPEGetVariable::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam) const { WBParamEvaluator::SEvaluatedParam Value; m_EntityPE->Evaluate(Context, Value); WBEntity* const pEntity = Value.GetEntity(); if (!pEntity) { return; } WBCompVariableMap* const pVariableMap = GET_WBCOMP(pEntity, VariableMap); if (!pVariableMap) { return; } const WBEvent& Variables = pVariableMap->GetVariables(); EvaluatedParam.Set(Variables.GetParameter(m_VariableName)); }
/*virtual*/ void WBPEEldGetSlot::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam) const { WBParamEvaluator::SEvaluatedParam EntityValue; m_EntityPE->Evaluate(Context, EntityValue); WBEntity* const pEntity = EntityValue.GetEntity(); if (!pEntity) { return; } WBCompEldItem* const pItem = GET_WBCOMP(pEntity, EldItem); if (!pItem) { return; } const HashedString SlotHash = pItem->GetSlot(); EvaluatedParam.m_Type = WBParamEvaluator::EPT_String; EvaluatedParam.m_String = ReverseHash::ReversedHash(SlotHash); }
void WBPEDiv::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam ) const { WBParamEvaluator::SEvaluatedParam ValueA; m_InputA->Evaluate( Context, ValueA ); WBParamEvaluator::SEvaluatedParam ValueB; m_InputB->Evaluate( Context, ValueB ); if( ValueA.m_Type == WBParamEvaluator::EPT_Vector ) { EvaluatedParam.m_Type = WBParamEvaluator::EPT_Vector; EvaluatedParam.m_Vector = ValueA.m_Vector / ValueB.GetFloat(); } else if( ValueB.m_Type == WBParamEvaluator::EPT_Vector ) { EvaluatedParam.m_Type = WBParamEvaluator::EPT_Vector; EvaluatedParam.m_Vector = ValueB.m_Vector / ValueA.GetFloat(); } else if( ValueA.m_Type == WBParamEvaluator::EPT_Int && ValueB.m_Type == WBParamEvaluator::EPT_Int ) { EvaluatedParam.m_Type = WBParamEvaluator::EPT_Int; EvaluatedParam.m_Int = ValueA.m_Int / ValueB.m_Int; } else { EvaluatedParam.m_Type = WBParamEvaluator::EPT_Float; EvaluatedParam.m_Float = ValueA.GetFloat() / ValueB.GetFloat(); } }
void WBPEMin::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam ) const { WBParamEvaluator::SEvaluatedParam ValueA; m_InputA->Evaluate( Context, ValueA ); WBParamEvaluator::SEvaluatedParam ValueB; m_InputB->Evaluate( Context, ValueB ); ASSERT( ValueA.m_Type == WBParamEvaluator::EPT_Int || ValueA.m_Type == WBParamEvaluator::EPT_Float ); ASSERT( ValueB.m_Type == WBParamEvaluator::EPT_Int || ValueB.m_Type == WBParamEvaluator::EPT_Float ); if( ValueA.m_Type == WBParamEvaluator::EPT_Int && ValueB.m_Type == WBParamEvaluator::EPT_Int ) { EvaluatedParam.m_Type = WBParamEvaluator::EPT_Int; EvaluatedParam.m_Int = Min( ValueA.m_Int, ValueB.m_Int ); } else { EvaluatedParam.m_Type = WBParamEvaluator::EPT_Float; EvaluatedParam.m_Float = Min( ValueA.GetFloat(), ValueB.GetFloat() ); } }
/*virtual*/ void WBPEGetState::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam ) const { WBParamEvaluator::SEvaluatedParam EntityValue; m_EntityPE->Evaluate( Context, EntityValue ); WBEntity* const pEntity = EntityValue.GetEntity(); if( !pEntity ) { return; } WBCompState* const pState = GET_WBCOMP( pEntity, State ); if( !pState ) { return; } const SimpleString State = ReverseHash::ReversedHash( pState->GetState() ); EvaluatedParam.m_Type = WBParamEvaluator::EPT_String; EvaluatedParam.m_String = State; }
/*virtual*/ void WBPEEldGetCharacterVO::Evaluate( const WBParamEvaluator::SPEContext& Context, WBParamEvaluator::SEvaluatedParam& EvaluatedParam) const { WBParamEvaluator::SEvaluatedParam EntityValue; m_EntityPE->Evaluate(Context, EntityValue); WBEntity* const pEntity = EntityValue.GetEntity(); if (!pEntity) { return; } WBCompEldCharacter* const pCharacter = GET_WBCOMP(pEntity, EldCharacter); if (!pCharacter) { return; } const SimpleString VoiceSet = pCharacter->GetCurrentVoiceSet(); MAKEHASH(VoiceSet); MAKEHASH(m_VO); EvaluatedParam.m_Type = WBParamEvaluator::EPT_String; EvaluatedParam.m_String = ConfigManager::GetString(sm_VO, "", sVoiceSet); }