void CombatGameInst::draw(GameState *gs) { GameView& view = gs->view(); SpriteEntry& spr = game_sprite_data[sprite]; Colour draw_colour = effects().effected_colour(); if (cooldowns().is_hurting()) { float s = 1 - hurt_alpha_value(cooldowns().hurt_cooldown); draw_colour = draw_colour.multiply(Colour(255, 255 * s, 255 * s)); } int sx = x - spr.width() / 2, sy = y - spr.height() / 2; gl_draw_sprite(view, sprite, sx, sy, vx, vy, gs->frame(), draw_colour); effects().draw_effect_sprites(gs, Pos(sx, sy)); if (is_resting) { GLimage& restimg = game_sprite_data[get_sprite_by_name("resting")].img(); gl_draw_image(view, restimg, x - spr.width() / 2, y - spr.height() / 2); } CoreStats& ecore = effective_stats().core; //Draw health bar int healthbar_offsety = 20; if (target_radius > 16) healthbar_offsety = target_radius + 8; if (ecore.hp < ecore.max_hp) { const BBox statbox(x - 10, y - healthbar_offsety, x + 10, y - healthbar_offsety + 5); gl_draw_statbar(view, statbox, ecore.hp, ecore.max_hp); } }
void MemoryValue::dumpMeta(CommaPrinter& comma, PrintStream& out) const { if (m_offset) out.print(comma, "offset = ", m_offset); if ((isLoad() && effects().reads != range()) || (isStore() && effects().writes != range())) out.print(comma, "range = ", range()); }
void Value::deepDump(PrintStream& out) const { out.print(m_type, " ", *this, " = ", m_opcode); out.print("("); CommaPrinter comma; for (Value* child : children()) out.print(comma, pointerDump(child)); if (m_origin) out.print(comma, m_origin); { StringPrintStream stringOut; dumpMeta(stringOut); CString string = stringOut.toCString(); if (string.length()) out.print(comma, string); } { CString string = toCString(effects()); if (string.length()) out.print(comma, string); } out.print(")"); }
void ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect) { EffectChain effects(this); gfxRGBA color(GetColor()); effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(color.r, color.g, color.b, color.a)); nsIntRect boundRect = GetBounds(); LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(), effects); gfx::Rect rect(boundRect.x, boundRect.y, boundRect.width, boundRect.height); gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height); float opacity = GetEffectiveOpacity(); const gfx::Matrix4x4& transform = GetEffectiveTransform(); mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform); mCompositor->DrawDiagnostics(DIAGNOSTIC_COLOR, rect, clipRect, transform); }
void MInstrEffects::get(const IRInstruction* inst, const FrameStateMgr& frame, LocalStateHook& hook) { // If the base for this instruction is a local address, the helper call might // have side effects on the local's value auto const base = inst->src(minstrBaseIdx(inst->op())); auto const locInstr = base->inst(); // Right now we require that the address of any affected local is the // immediate source of the base tmp. This isn't actually specified in the ir // spec right now but will intend to make it more general soon. if (locInstr->op() != LdLocAddr) return; auto const locId = locInstr->extra<LdLocAddr>()->locId; auto const baseType = frame.localType(locId); MInstrEffects effects(inst->op(), baseType.ptr(Ptr::Frame)); if (effects.baseTypeChanged || effects.baseValChanged) { auto const ty = effects.baseType.derefIfPtr(); if (ty.isBoxed()) { hook.setLocalType(locId, Type::BoxedInitCell); hook.setBoxedLocalPrediction(locId, ty); } else { hook.setLocalType(locId, ty); } } }
void ColorSchemePrivate::init(QPalette::ColorGroup state, const char* group, SetDefaultColors defaults) { // loaded-from-config colors _brushes.fg[0] = SET_DEFAULT(NormalText); _brushes.fg[1] = SET_DEFAULT(InactiveText); _brushes.fg[2] = SET_DEFAULT(ActiveText); _brushes.fg[3] = SET_DEFAULT(LinkText); _brushes.fg[4] = SET_DEFAULT(VisitedText); _brushes.fg[5] = SET_DEFAULT(NegativeText); _brushes.fg[6] = SET_DEFAULT(NeutralText); _brushes.fg[7] = SET_DEFAULT(PositiveText); _brushes.deco[0] = DECO_DEFAULT(Hover); _brushes.deco[1] = DECO_DEFAULT(Focus); // apply state adjustments if (state != QPalette::Active) { StateEffects effects(state); for (int i = 0; i < 8; i++) { _brushes.fg[i] = effects.brush(_brushes.fg[i], _brushes.bg[0]); } _brushes.deco[0] = effects.brush(_brushes.deco[0], _brushes.bg[0]); _brushes.deco[1] = effects.brush(_brushes.deco[1], _brushes.bg[0]); _brushes.bg[0] = effects.brush(_brushes.bg[0]); _brushes.bg[1] = effects.brush(_brushes.bg[1]); } // calculated backgrounds _brushes.bg[2] = ColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[2].color()); _brushes.bg[3] = ColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[3].color()); _brushes.bg[4] = ColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[4].color()); _brushes.bg[5] = ColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[5].color()); _brushes.bg[6] = ColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[6].color()); _brushes.bg[7] = ColorUtils::tint(_brushes.bg[0].color(), _brushes.fg[7].color()); }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: openFile(); break; case 1: applyChanges(); break; case 2: saveFile(); break; case 3: exit(); break; case 4: effects(); break; case 5: zoom(); break; case 6: resize(); break; case 7: crop(); break; case 8: rotateRight(); break; case 9: rotateLeft(); break; case 10: mirror(); break; case 11: reflection(); break; case 12: grayScale(); break; case 13: xray(); break; case 14: sepia(); break; default: ; } _id -= 15; } return _id; }
void PlayerInst::use_rest(GameState* gs, const GameAction& action) { if (!effective_stats().allowed_actions.can_use_rest) { return; } CoreStats& ecore = effective_stats().core; int emax_hp = ecore.max_hp, emax_mp = ecore.max_mp; bool atfull = core_stats().hp >= emax_hp && core_stats().mp >= emax_mp; if (cooldowns().can_rest() && !atfull && effects().can_rest()) { core_stats().heal_hp(ecore.hpregen * 8, emax_hp); core_stats().heal_mp(ecore.mpregen * 8, emax_mp); ecore.hp = core_stats().hp; ecore.mp = core_stats().mp; is_resting = true; } }
void SequenceElements::RenameTimingTrack(std::string oldname, std::string newname) { // actual timing track name already updated ... we just need to update any effects that care about the timing track name // faces, state, piano, vumeter std::vector<RenderableEffect*> effects(GetEffectManager().size()); int count = 0; for (int x = 0; x < GetEffectManager().size(); x++) { RenderableEffect *eff = GetEffectManager()[x]; effects[x] = eff; } for (size_t i = 0; i < GetElementCount(); i++) { Element* elem = GetElement(i); if (elem->GetType() == "model") { for (int j = 0; j < elem->GetEffectLayerCount(); j++) { EffectLayer* layer = elem->GetEffectLayer(j); for (int k = 0; k < layer->GetEffectCount(); k++) { Effect* eff = layer->GetEffect(k); if (effects[eff->GetEffectIndex()] != nullptr) { effects[eff->GetEffectIndex()]->RenameTimingTrack(oldname, newname, eff); } } } for (int j = 0; j < elem->getStrandLayerCount(); j++) { StrandLayer* layer = elem->GetStrandLayer(j); for (int k = 0; k < layer->GetEffectCount(); k++) { Effect* eff = layer->GetEffect(k); if (effects[eff->GetEffectIndex()] != nullptr) { effects[eff->GetEffectIndex()]->RenameTimingTrack(oldname, newname, eff); } } for (int k = 0; k < layer->GetNodeLayerCount(); k++) { NodeLayer* nlayer = layer->GetNodeLayer(k); for (int l = 0; l < nlayer->GetEffectCount(); l++) { Effect* eff = nlayer->GetEffect(l); if (effects[eff->GetEffectIndex()] != nullptr) { effects[eff->GetEffectIndex()]->RenameTimingTrack(oldname, newname, eff); } } } } } } }
void Value::deepDump(PrintStream& out) const { out.print(m_type, " ", *this, " = ", m_opcode); out.print("("); CommaPrinter comma; dumpChildren(comma, out); if (m_origin) out.print(comma, m_origin); dumpMeta(comma, out); { CString string = toCString(effects()); if (string.length()) out.print(comma, string); } out.print(")"); }
void MWMechanics::Alchemy::updateEffects() { mEffects.clear(); mValue = 0; if (countIngredients()<2 || mAlchemist.isEmpty() || mTools[ESM::Apparatus::MortarPestle].isEmpty()) return; // find effects std::set<EffectKey> effects (listEffects()); // general alchemy factor float x = getAlchemyFactor(); x *= mTools[ESM::Apparatus::MortarPestle].get<ESM::Apparatus>()->mBase->mData.mQuality; x *= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionStrengthMult")->getFloat(); // value mValue = static_cast<int> ( x * MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("iAlchemyMod")->getFloat()); // build quantified effect list for (std::set<EffectKey>::const_iterator iter (effects.begin()); iter!=effects.end(); ++iter) { const ESM::MagicEffect *magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (iter->mId); if (magicEffect->mData.mBaseCost<=0) { std::ostringstream os; os << "invalid base cost for magic effect " << iter->mId; throw std::runtime_error (os.str()); } float fPotionT1MagMul = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionT1MagMult")->getFloat(); if (fPotionT1MagMul<=0) throw std::runtime_error ("invalid gmst: fPotionT1MagMul"); float fPotionT1DurMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionT1DurMult")->getFloat(); if (fPotionT1DurMult<=0) throw std::runtime_error ("invalid gmst: fPotionT1DurMult"); float magnitude = magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude ? 1 : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost; float duration = magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration ? 1 : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost; if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude)) applyTools (magicEffect->mData.mFlags, magnitude); if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration)) applyTools (magicEffect->mData.mFlags, duration); duration = roundf(duration); magnitude = roundf(magnitude); if (magnitude>0 && duration>0) { ESM::ENAMstruct effect; effect.mEffectID = iter->mId; effect.mAttribute = -1; effect.mSkill = -1; if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill) effect.mSkill = iter->mArg; else if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute) effect.mAttribute = iter->mArg; effect.mRange = 0; effect.mArea = 0; effect.mDuration = static_cast<int>(duration); effect.mMagnMin = effect.mMagnMax = static_cast<int>(magnitude); mEffects.push_back (effect); } } }
TEST(MInstrEffects, NonObjProp) { MInstrEffects effects(SetProp, TLvalToInt); EXPECT_TEQ(TLvalToInt, effects.baseType); EXPECT_FALSE(effects.baseTypeChanged); EXPECT_FALSE(effects.baseValChanged); }
TEST(MInstrEffects, NonArrElem) { MInstrEffects effects(SetElem, TLvalToDbl); EXPECT_TEQ(TLvalToDbl, effects.baseType); EXPECT_FALSE(effects.baseTypeChanged); EXPECT_FALSE(effects.baseValChanged); }
void visitLoop(Loop* loop) { // We accumulate all the code we can move out, and will place it // in a block just preceding the loop. std::vector<Expression*> movedCode; // Accumulate effects of things we can't move out - things // we move out later must cross them, so we must verify it // is ok to do so. EffectAnalyzer effectsSoFar(getPassOptions()); // The loop's total effects also matter. For example, a store // in the loop means we can't move a load outside. // FIXME: we look at the loop "tail" area too, after the last // possible branch back, which can cause false positives // for bad effect interactions. EffectAnalyzer loopEffects(getPassOptions(), loop); // Note all the sets in each loop, and how many per index. Currently // EffectAnalyzer can't do that, and we need it to know if we // can move a set out of the loop (if there is another set // still there, we can't). Another possible option here is for // LocalGraph to track interfering sets. TODO // FIXME: also the loop tail issue from above. auto numLocals = getFunction()->getNumLocals(); std::vector<Index> numSetsForIndex(numLocals); std::fill(numSetsForIndex.begin(), numSetsForIndex.end(), 0); LoopSets loopSets; { FindAll<SetLocal> finder(loop); for (auto* set : finder.list) { numSetsForIndex[set->index]++; loopSets.insert(set); } } // Walk along the loop entrance, while all the code there // is executed unconditionally. That is the code we want to // move out - anything that might or might not be executed // may be best left alone anyhow. std::vector<Expression**> work; work.push_back(&loop->body); while (!work.empty()) { auto** currp = work.back(); work.pop_back(); auto* curr = *currp; // Look into blocks. if (auto* block = curr->dynCast<Block>()) { auto& list = block->list; Index i = list.size(); while (i > 0) { i--; work.push_back(&list[i]); } continue; // Note that if the block had a merge at the end, we would have seen // a branch to it anyhow, so we would stop before that point anyhow. } // If this may branch, we are done. EffectAnalyzer effects(getPassOptions(), curr); if (effects.branches) { break; } if (interestingToMove(curr)) { // Let's see if we can move this out. // Global side effects would prevent this - we might end up // executing them just once. // And we must also move across anything not moved out already, // so check for issues there too. // The rest of the loop's effects matter too, we must also // take into account global state like interacting loads and // stores. bool unsafeToMove = effects.hasGlobalSideEffects() || effectsSoFar.invalidates(effects) || (effects.noticesGlobalSideEffects() && loopEffects.hasGlobalSideEffects()); if (!unsafeToMove) { // So far so good. Check if our local dependencies are all // outside of the loop, in which case everything is good - // either they are before the loop and constant for us, or // they are after and don't matter. if (effects.localsRead.empty() || !hasGetDependingOnLoopSet(curr, loopSets)) { // We have checked if our gets are influenced by sets in the loop, and // must also check if our sets interfere with them. To do so, assume // temporarily that we are moving curr out; see if any sets remain for // its indexes. FindAll<SetLocal> currSets(curr); for (auto* set : currSets.list) { assert(numSetsForIndex[set->index] > 0); numSetsForIndex[set->index]--; } bool canMove = true; for (auto* set : currSets.list) { if (numSetsForIndex[set->index] > 0) { canMove = false; break; } } if (!canMove) { // We failed to move the code, undo those changes. for (auto* set : currSets.list) { numSetsForIndex[set->index]++; } } else { // We can move it! Leave the changes, move the code, and update // loopSets. movedCode.push_back(curr); *currp = Builder(*getModule()).makeNop(); for (auto* set : currSets.list) { loopSets.erase(set); } continue; } } } } // We did not move this item. Accumulate its effects. effectsSoFar.mergeIn(effects); } // If we moved the code out, finish up by emitting it // outside of the loop. // Note that this works with nested loops - after moving outside // of an inner loop, we can encounter it again in an outer loop, // and move it further outside, without requiring any extra pass. if (!movedCode.empty()) { // Finish the moving by emitting the code outside. Builder builder(*getModule()); auto* ret = builder.makeBlock(movedCode); ret->list.push_back(loop); ret->finalize(loop->type); replaceCurrent(ret); // Note that we do not need to modify the localGraph - we keep // each get in a position to be influenced by exactly the same // sets as before. } }
int main(int argc, char *args[]) { int cn = 0, srank = 0; query = getenv("QUERY_STRING"); if (query && !strncmp(query, "cn=", 3)) { cn = atoi(query + 3); } if (query && !strncmp(query, "rank=", 5)) { srank = atoi(query + 5); } chdir("/home/merc"); printf("Content-Type: text/html\n\n"); printf("<html><head><title>Server Info</title></head>\n"); printf("<BODY TEXT=#D7D700 BGCOLOR=#264A9F LINK=#FFFFBB VLINK=#CCCC00 ALINK=#FFFF9D background=/gfx/back4.gif>"); printf("<center>"); printf("<table width=\"100%%\"><tr>"); printf( " <table width=\"100%%\">" " <tr>" " <td align=\"center\"><a href=\"http://www.astonia.com/\"><img src=\"/gfx/logo.gif\" width=\"100\" height=\"60\" border=\"0\"></a></td>" " <td align=\"center\">" " <a href=\"/\">Home</a>" " <a href=\"/manual.html\">Manual</a>" " <a href=\"/terms.html\">Terms</a>" " <a href=\"/download.html\">Download</a>" " <a href=\"/contact.html\">Contact</a>" " <a href=\"/cgi-bin/info.cgi\">Server Status</a>" " <a href=\"/cgi-bin/who.cgi\">Who's Online</a>" " <a href=\"/bugs.html\">Bugs</a>" " <a href=\"/changes.html\">Changes</a>" " <a href=\"/creators.html\">Creators</a>" " <a href=\"/links.html\">Links</a>" " <a href=\"/privacy.html\">Privacy</a>" " </td>" " <td align=\"center\"><a href=\"http://www.astonia.com/\"><img src=\"/gfx/logo.gif\" width=\"100\" height=\"60\" border=\"0\"></a></td>" " </tr>" " </table>"); printf("</td></tr></table>"); printf("<img src=/gfx/barsmall.gif border=0 align=left alt=---- width=100%% height=5><br>"); printf("<table width=60%%><tr><td>\n"); if (load()) { printf("<b>Cannot access server data. Exiting... (%s)</b></td></tr></table>", strerror(errno)); exit(0); } if (args[0]) { if (strcmp(args[0], "who.cgi")==0) { who(); } else if (strcmp(args[0], "top.cgi")==0) { top(); } else if (strcmp(args[0], "info.cgi")==0) { info(cn); } else if (strcmp(args[0], "hog.cgi")==0) { hog(); } else if (strcmp(args[0], "gods.cgi")==0) { gods(); } else if (strcmp(args[0], "staff.cgi")==0) { staff(); } else if (strcmp(args[0], "effects.cgi")==0) { effects(); } else if (strcmp(args[0], "xtop.cgi")==0) { xtop(srank); } else if (strcmp(args[0], "dtop.cgi")==0) { dtop(srank); } else { printf("Internal error... (%s)\n", args[0]); } } else { printf("Internal error..."); } unload(); printf("</td></tr></table><br>"); printf( "<img src=\"/gfx/barsmall.gif\" border=0 align=\"left\" alt=\"----\" width=\"100%%\" height=5><br>" "<table width=\"100%%\" cellpadding=0 cellspacing=0 border=0><tr>" "<td width=\"33%%\" align=center><a href=/devel.html>Back to main page</a></td>" "<td width=\"33%%\" align=center> </td>" "<td width=\"33%%\" align=center><font size=-1>All material on this server is copyright " "<a href=mailto:[email protected]>D.Brockhaus</a></font></td>" "</tr></table>" "</center><br><br>" "</body></html>"); return(0); }
TEST(MInstrEffects, UnknownBase) { MInstrEffects effects(SetElem, TLvalToCell); EXPECT_TEQ(TLvalToCell - TLvalToNull, effects.baseType); EXPECT_TRUE(effects.baseTypeChanged); EXPECT_TRUE(effects.baseValChanged); }
TBool CHuiFxEffect::NotifyEffectEndObserver() { if (iFlags & KHuiEffectObserverNotified) { return ETrue; } SetEffectFlag(KHuiEffectObserverNotified); // prevent extra notifier calls calls // fade effect should not have observers if (iFlags & KHuiFadeEffectFlag) { return ETrue; // fade effect does not have observer that would need notification } #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF TTime endTime; endTime.UniversalTime(); // There might be several BeginFullScreen for single effects. We want to calculate // reaction time from the first BeginFullScreen event to this point TInt timeStamps = 0; AMT_GET_TIME_POINT_COUNT(iHandle, timeStamps); TInt64 temp; TBool effects(EFalse); // dummy, 1 if effects were on for this time stamp AMT_GET_TIME(temp, iHandle, 0, effects); TTime startTime(temp); AMT_GET_TIME(temp, iHandle, timeStamps - 1, effects); TTime effectStartTime(temp); TInt64 effectTime = endTime.MicroSecondsFrom(effectStartTime).Int64(); TReal fps = (TReal)iFramesDrawn / ((TReal)effectTime / 1000000.0f) ; TInt64 totalEffectTime = endTime.MicroSecondsFrom(startTime).Int64(); TInt64 reactionTime = effectStartTime.MicroSecondsFrom(startTime).Int64(); RDebug::Printf("CHuiFxEffect::NotifyEffectEndObserver - Reaction time \t0x%x\t%f\tVisible effect time:\t%f\ts. (%f FPS). Total effect time:\t%f", iHandle, (TReal)reactionTime / 1000000.0f, ((TReal)effectTime)/1000000, fps, ((TReal)totalEffectTime)/1000000.0f ); AMT_RESET_TIME(iHandle); #endif if (iEffectEndObserver) { // The callback can be called only once when the effect finishes MAlfGfxEffectObserver* effectEndObserver = iEffectEndObserver; iEffectEndObserver = NULL; // Note: The call below may synchronously delete me (CHuiFxEffect instance) effectEndObserver->AlfGfxEffectEndCallBack( iHandle ); return ETrue; // end observer notified } else { // must be notified without destroying the effect first. gives alf apps chance // to do their own cleanup return EFalse; } }
TEST(MInstrEffects, BadArrayKey) { MInstrEffects effects(SetElem, TLvalToArr); EXPECT_TEQ(TLvalToArr, effects.baseType); EXPECT_FALSE(effects.baseTypeChanged); EXPECT_TRUE(effects.baseValChanged); }