void GaussianBlurShader::DoApplyTech(Engine& engine) { if (!engine.GetTexture(0) || engine.GetTexture(0)->GetType() != D3DRTYPE_TEXTURE) throw int(); D3DSURFACE_DESC texDesc; static_cast<IDirect3DTexture9*>(engine.GetTexture(0))->GetLevelDesc(0, &texDesc); float fWidth = 0; float fHeight = 0; switch (curTechnique) { case ttHorizontal: fWidth = 1.0f / texDesc.Width; break; case ttVertical: fHeight = 1.0f / texDesc.Height; break; default: throw int(); } GetEffect()->SetTexture(_colorTex, engine.GetTexture(0)); GetEffect()->SetFloatArray(_colorTexSizes, D3DXVECTOR2(fWidth, fHeight), 2); GetEffect()->SetTechnique(_techGaussianBlur); GetEffect()->Begin(&_cntPass, 0); }
func IsReflectable(object clonk) { if(clonk == master || GetEffect("Blocked", this) || GetEffect("FollowMaster", this) || GetEffect("Discharge", this)) return 0; return 1; }
void GaussianBlurShader::DoInit() { D3DXEffect::DoInit(); _colorTex = GetEffect()->GetParameterByName(0, "colorTex"); _colorTexSizes = GetEffect()->GetParameterByName(0, "colorTexSizes"); _techGaussianBlur = GetEffect()->GetTechniqueByName("techGaussianBlur"); }
func ControlStop(object clonk, int control) { if (GetEffect("ElevatorControl", this)) if (control == CON_Up || control == CON_Down) { var effect = GetEffect("ElevatorControl", this); effect.controlled = nil; return effect.case->ControlStop(clonk, control); }
BOOL CEffectManager::ForcedEndEffect(HEFFPROC handle) { if(m_bInited == FALSE) return TRUE; ASSERT(handle); CEffect* pEffect = GetEffect(handle); if(pEffect == NULL) return TRUE; EFFECTPARAM param; param.Copy(pEffect->GetEffectParam()); DWORD Key = (DWORD)pEffect->GetEffectID(); DWORD NextEffect = pEffect->GetNextEffect(); DWORD RefCount = pEffect->GetRefCount(); int EffectKind = pEffect->GetEffectKind(); pEffect->DecRefCount(); if(pEffect->GetRefCount() > 0) return FALSE; EndProcess(pEffect); // if(NextEffect) // { // HEFFPROC proc = StartEffectProcess(EffectKind,NextEffect,¶m,Key,RefCount); // CEffect* pNextEffect = GetEffect(proc); //// ASSERT(pNextEffect); // if(pNextEffect) // pNextEffect->SetEndFlag(); // } // 080425 NYJ --- NextEffect가 여러개인 경우 루프를 돌면서 모두 중단시킴 int nCnt = 0; while(NextEffect) { if( 99 < nCnt) break; HEFFPROC proc = StartEffectProcess(EffectKind,NextEffect,¶m,Key,RefCount); NextEffect = 0; CEffect* pNextEffect = GetEffect(proc); if(pNextEffect) { EndProcess(pNextEffect); NextEffect = pNextEffect->GetNextEffect(); } nCnt++; } return TRUE; }
void HandleApplyEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) { // Divine touch if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, EFFECT_0)) { uint32 heal = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), GetEffect(EFFECT_0)->GetAmount(), DOT); heal = GetTarget()->SpellHealingBonusTaken(GetSpellInfo(), heal, DOT, 1, caster->GetGUID()); int32 basepoints0 = aurEff->GetAmount() * GetEffect(EFFECT_0)->GetTotalTicks() * int32(heal) / 100; caster->CastCustomSpell(GetTarget(), 63544, &basepoints0, NULL, NULL, true, NULL, aurEff); } } }
void EmitterAttributeEditor::HandleEmissionRateChanged(float value) { if(updatingWidget_) return; FloatEditor* editor = (FloatEditor*)sender(); if(editor == emissionRateMinEditor_) { GetEffect()->SetMinEmissionRate(value); } else if(editor == emissionRateMaxEditor_) { GetEffect()->SetMaxEmissionRate(value); } }
func FxCheckEnemiesTimer(object target, proplist effect, int time) { for(var o in FindObjects(Find_Distance(Size), Find_Not(Find_ID(Hook)), Find_Or(Find_Func("IsReflectable"), Find_Func("CanBeHit", this)))) { if(GetEffect("SawBladeCD", o) || (o->GetOwner() == GetOwner() && time < 15)) { continue; } var angle = Angle(GetX(), GetY(), o->GetX(), o->GetY()); AddEffect("SawBladeCD", o, 1, 25); if(!o->GetAlive()) { if(o->~IsWallElement()) continue; var speed = Distance(0, 0, o->GetXDir(), o->GetYDir()); o->SetVelocity(angle, speed); o->~Blocked(this); WeaponDamage(o, SpellDamage); Sound("Hits::GeneralHit*", false, 50); continue; } Sound("Objects::Weapons::WeaponHit*", false, 50); o->Fling(Sin(angle, 8), -Cos(angle, 8)); WeaponDamage(o, SpellDamage); } }
void CEffectManager::OnEffectTimeOut(HEFFPROC handle) { ASSERT(handle); CEffect* pEffect = GetEffect(handle); if(pEffect == NULL) return; BOOL bEndFlag = pEffect->IsEndFlag(); if(pEffect->IsRepeatEffect() && bEndFlag == FALSE) ResetProcess(pEffect); else { EFFECTPARAM param; param.Copy(pEffect->GetEffectParam()); param.m_DamageRate = 0; DWORD Key = (DWORD)pEffect->GetEffectID(); DWORD NextEffect = pEffect->GetNextEffect(); DWORD RefCount = pEffect->GetRefCount(); int EffectKind = pEffect->GetEffectKind(); EndProcess(pEffect); if(NextEffect) { HEFFPROC proc = StartEffectProcess(EffectKind,NextEffect,¶m,Key,RefCount); if(bEndFlag) { SetEffectEndFlag(proc); } } } }
//---------------------------------------------------------------------------------- // //---------------------------------------------------------------------------------- void EffectNodeRing::EndRendering(Manager* manager) { RingRenderer* renderer = manager->GetRingRenderer(); if( renderer != NULL ) { RingRenderer::NodeParameter nodeParameter; nodeParameter.AlphaBlend = AlphaBlend; nodeParameter.TextureFilter = RendererCommon.FilterType; nodeParameter.TextureWrap = RendererCommon.WrapType; nodeParameter.ZTest = RendererCommon.ZTest; nodeParameter.ZWrite = RendererCommon.ZWrite; nodeParameter.Billboard = Billboard; nodeParameter.ColorTextureIndex = RingTexture; nodeParameter.EffectPointer = GetEffect(); nodeParameter.IsRightHand = manager->GetCoordinateSystem() == CoordinateSystem::RH; nodeParameter.Distortion = RendererCommon.Distortion; nodeParameter.DistortionIntensity = RendererCommon.DistortionIntensity; nodeParameter.DepthOffset = DepthValues.DepthOffset; nodeParameter.IsDepthOffsetScaledWithCamera = DepthValues.IsDepthOffsetScaledWithCamera; nodeParameter.IsDepthOffsetScaledWithParticleScale = DepthValues.IsDepthOffsetScaledWithParticleScale; renderer->EndRendering( nodeParameter, m_userData ); } }
void EmitterAttributeEditor::HandleRelativeChanged(int value) { if(updatingWidget_) return; GetEffect()->SetRelative(value == 1); }
void HandleDispel(DispelInfo* dispelInfo) { if (Unit* target = GetUnitOwner()) { if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) { // final heal int32 healAmount = aurEff->GetAmount(); if (Unit* caster = GetCaster()) { healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, aurEff->GetSpellEffectInfo(), dispelInfo->GetRemovedCharges()); healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, aurEff->GetSpellEffectInfo(), dispelInfo->GetRemovedCharges()); target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); // restore mana std::vector<SpellInfo::CostData> costs = GetSpellInfo()->CalcPowerCost(caster, GetSpellInfo()->GetSchoolMask()); auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; }); if (m != costs.end()) { int32 returnMana = m->Amount * dispelInfo->GetRemovedCharges() / 2; caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID()); } return; } target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID()); } } }
func HitByHook(hook) { if(!snapped) return; Unstuck(); snapped = 0; var fx = GetEffect("Travel", this); RemoveEffect("Travel", this); SetAction("Idle"); /* var dir; if(GetX() > hook->GetX()) dir = 1; else dir = -1;*/ var angle = Angle(hook->GetX(), hook->GetY(), GetX(), GetY()); //var angle = fx.angle - 45 * -fx.dir; var xdir = Sin(angle, Speed); var ydir = -Cos(angle, Speed); //var xdir = Cos(angle, Speed); //var ydir = Sin(angle, Speed); Bounce(xdir, ydir); }
func CheckForEnemies(Size) { for(var o in FindObjects(Find_Distance(Size), Find_Func("CanBeHit", this))) { if(o->GetOwner() == GetOwner() || GetEffect("BallHitCD", o)) continue; o->AddBallHitEffect(); o->Fling(0, -2); AddEffect("BallHitCD", o, 1, 15); var trailparticles = { Prototype = Particles_ElectroSpark2(), Size = PV_Linear(PV_Random(5,15),0), BlitMode = GFX_BLIT_Additive, Rotation = PV_Random(0,360), R = pR, G = pG, B = pB, }; CreateParticle("Lightning", o->GetX() - GetX(), o->GetY() - GetY(), 0, 0, 10, trailparticles, 5); WeaponDamage(o, SpellDamage); Sound("Ball::ball_hit", false, 50); } }
bool EffectManager::DoEffect(const PluginID & ID, wxWindow *parent, double projectRate, TrackList *list, TrackFactory *factory, SelectedRegion *selectedRegion, bool shouldPrompt /* = true */) { this->SetSkipStateFlag(false); Effect *effect = GetEffect(ID); if (!effect) { return false; } #if defined(EXPERIMENTAL_EFFECTS_RACK) if (effect->SupportsRealtime()) { GetRack()->Add(effect); } #endif bool res = effect->DoEffect(parent, projectRate, list, factory, selectedRegion, shouldPrompt); return res; }
wxString EffectManager::GetDefaultPreset(const PluginID & ID) { Effect *effect = GetEffect(ID); if (!effect) { return wxEmptyString; } wxString preset; if (effect->HasCurrentSettings()) { preset = Effect::kCurrentSettingsIdent; } else if (effect->HasFactoryDefaults()) { preset = Effect::kFactoryDefaultsIdent; } if (!preset.IsEmpty()) { EffectAutomationParameters eap; eap.Write(wxT("Use Preset"), preset); eap.GetParameters(preset); } return preset; }
wxString EffectManager::GetPreset(const PluginID & ID, const wxString & params, wxWindow * parent) { Effect *effect = GetEffect(ID); if (!effect) { return wxEmptyString; } EffectAutomationParameters eap(params); wxString preset; if (eap.HasEntry(wxT("Use Preset"))) { preset = eap.Read(wxT("Use Preset")); } preset = effect->GetPreset(parent, preset); if (preset.IsEmpty()) { return preset; } eap.DeleteAll(); eap.Write(wxT("Use Preset"), preset); eap.GetParameters(preset); return preset; }
void ParticleAttributeEditor::HanldeValueVarianceEditorValueChanged(float average, float variance) { if (updatingWidget_) return; ParticleEffect2D* effect = GetEffect(); QObject* s = sender(); if (s == particleLifeSpanEditor_) { effect->SetParticleLifeSpan(average); effect->SetParticleLifespanVariance(variance); } else if (s == startSizeEditor_) { effect->SetStartParticleSize(average); effect->SetStartParticleSizeVariance(variance); } else if (s == finishSizeEditor_) { effect->SetFinishParticleSize(average); effect->SetFinishParticleSizeVariance(variance); } else if (s == startRotationEditor_) { effect->SetRotationStart(average); effect->SetRotationStartVariance(variance); } else if (s == finishRotationEditor_) { effect->SetRotationEnd(average); effect->SetRotationEndVariance(variance); } }
void Layer::SerializeTo(SerializerElement& element) const { element.SetAttribute("name", GetName()); element.SetAttribute("visibility", GetVisibility()); SerializerElement& camerasElement = element.AddChild("cameras"); camerasElement.ConsiderAsArrayOf("camera"); for (std::size_t c = 0; c < GetCameraCount(); ++c) { SerializerElement& cameraElement = camerasElement.AddChild("camera"); cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize()); cameraElement.SetAttribute("width", GetCamera(c).GetWidth()); cameraElement.SetAttribute("height", GetCamera(c).GetHeight()); cameraElement.SetAttribute("defaultViewport", GetCamera(c).UseDefaultViewport()); cameraElement.SetAttribute("viewportLeft", GetCamera(c).GetViewportX1()); cameraElement.SetAttribute("viewportTop", GetCamera(c).GetViewportY1()); cameraElement.SetAttribute("viewportRight", GetCamera(c).GetViewportX2()); cameraElement.SetAttribute("viewportBottom", GetCamera(c).GetViewportY2()); } SerializerElement& effectsElement = element.AddChild("effects"); effectsElement.ConsiderAsArrayOf("effect"); for (std::size_t i = 0; i < GetEffectsCount(); ++i) { SerializerElement& effectElement = effectsElement.AddChild("effect"); GetEffect(i).SerializeTo(effectElement); } }
global func Attach2(object pObj, object pTarget) { // Kein Objekt vorhanden oder schon irgendwo attached? if (!pObj || !pTarget && !(pTarget = this) || GetEffect("Attach", pTarget)) return; return AddEffect("Attach", pTarget, 1, 1, 0, 0, pObj); }
global func FxIntCyclopsAITimer(object cyclops, proplist fx, int time) { if (!fx.cyclops) { fx.cyclops = cyclops; fx.weapon = cyclops->FindContents(Club); } if (!fx.eye) fx.eye = FindObject(Find_ID(CyclopsEye)); fx.time = time; // do not idle var effect = GetEffect("IntWalk", fx.cyclops); if (effect) effect.idle_time = 0; fx.eye->SetPosition(fx.cyclops->GetX() -4 + fx.cyclops->GetDir() * 8, fx.cyclops->GetY() - 19); // Find an enemy if (fx.target) if (!fx.target->GetAlive() || (!fx.ranged && ObjectDistance(fx.target) >= fx.max_aggro_distance)) fx.target = nil; if (!fx.target) { if (!(fx.target = CyclopsFindTarget(fx))) return CyclopsExecuteIdle(fx); } // Attack it! return CyclopsExecuteMelee(fx, time); }
void EmitterAttributeEditor::HandleInActiveTimeChanged(float value) { if(updatingWidget_) return; GetEffect()->SetInactiveTime(value); }
global func AddCyclopsAI(object clonk) // somewhat hacky, but it works { var effect_name = "IntCyclopsAI"; var fx = GetEffect(effect_name, clonk); if (!fx) fx = AddEffect(effect_name, clonk, 1, 2); if (!fx || !clonk) return nil; clonk.ai = fx; // bin inventory var cnt = clonk->ContentsCount(); fx.bound_weapons = CreateArray(cnt); for (var i=0; i<cnt; ++i) fx.bound_weapons[i] = clonk->Contents(i); // set home fx.home_x = clonk->GetX(); fx.home_y = clonk->GetY(); fx.home_dir = DIR_Left; // set guard range fx.guard_range = { x = fx.home_x-AI_DefGuardRangeX, y = fx.home_y-AI_DefGuardRangeY, wdt = AI_DefGuardRangeX*2, hgt = AI_DefGuardRangeY*2}; fx.spray_old = {time = 0, v0 = 0, v1 = 0, reach = 0}; fx.spray_cur = {time = 0, v0 = 0, v1 = 0, reach = 0}; AI->SetMaxAggroDistance(clonk, AI_DefMaxAggroDistance); return fx; }
func FxLifeStop() { if(!GetEffect("Pull", this)) { AddEffect("Comeback", this, 1, 1, this); } }
// Set the maximum distance the enemy will follow an attacking Clonk func SetMaxAggroDistance(object clonk, int max_dist) { var fx = GetEffect("S2AI", clonk); if (!fx || !clonk) return false; fx.max_aggro_distance = max_dist; return true; }
Effect* Assets::CreateEffect(const std::string& name) { Effect* effect = GetEffect(name); if (effect==NULL) { // Item NOT found effect = new Effect(name); effectAssets[name] = effect; } return effect; /*Effect* effect = NULL; std::map<std::string, Effect*>::iterator iter; iter = effectAssets.find(name); if (iter!=effectAssets.end()) { // Item found effect = iter->second; } else { // Item NOT found effect = new Effect(); effectAssets[name] = effect; } //std::cout << "done (len="<<effectAssets.size()<<")"<<std::endl<< std::flush; return effect;*/ }
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); AuraEffect* counter = GetEffect(EFFECT_1); if (!counter) return; // Count spell criticals in a row in second aura if (eventInfo.GetHitMask() & PROC_HIT_CRITICAL) { counter->SetAmount(counter->GetAmount() * 2); if (counter->GetAmount() < 100) // not enough return; // roll chance if (!roll_chance_i(aurEff->GetAmount())) return; Unit* caster = eventInfo.GetActor(); caster->CastSpell(caster, SPELL_MAGE_HOT_STREAK_PROC, true, nullptr, aurEff); } // reset counter counter->SetAmount(25); }
void Material::Bind() { Effect* effect = GetEffect(); for_each(I32Params.begin(), I32Params.end(), [&effect](const pair<string, I32>& keyValuePair){ effect->SetParam(keyValuePair.first, keyValuePair.second); }); for_each(F32Params.begin(), F32Params.end(), [&effect](const pair<string, F32>& keyValuePair){ effect->SetParam(keyValuePair.first, keyValuePair.second); }); for_each(boolParams.begin(), boolParams.end(), [&effect](const pair<string, bool>& keyValuePair){ effect->SetParam(keyValuePair.first, keyValuePair.second); }); for_each(vector2fParams.begin(), vector2fParams.end(), [&effect](const pair<string, Vector2f>& keyValuePair){ effect->SetParam(keyValuePair.first, keyValuePair.second); }); for_each(vector3fParams.begin(), vector3fParams.end(), [&effect](const pair<string, Vector3f>& keyValuePair){ effect->SetParam(keyValuePair.first, keyValuePair.second); }); for_each(vector4fParams.begin(), vector4fParams.end(), [&effect](const pair<string, Vector4f>& keyValuePair){ effect->SetParam(keyValuePair.first, keyValuePair.second); }); for_each(matrixParams.begin(), matrixParams.end(), [&effect](const pair<string, Matrix>& keyValuePair){ effect->SetParam(keyValuePair.first, keyValuePair.second); }); for_each(textureParams.begin(), textureParams.end(), [&effect](const pair<string, Texture*>& keyValuePair){ effect->SetParam(keyValuePair.first, keyValuePair.second); }); }
func FxProducePowerStop(target, effect, reason, temp) { if(temp) return; MakePowerProducer(0); if(GetEffect("Sparkle", this)) RemoveEffect("Sparkle", this); }
void EmitterAttributeEditor::HandleIsSortedChanged(int value) { if(updatingWidget_) return; GetEffect()->SetSorted(value == 1); GetEmitter()->SetSorted(value == 1); }